Content of first.tf
mkdir template-example
cd template-example
mkdir templates
vi index.j2 # Copy the content from ../../notes/ansible/example/sample
$ cd ..
# Declare var yourname ,age}},emailaddress in Playbook.
vi web_db.yaml
--------------------------------
---
- hosts: webservers
sudo: yes
vars:
http_port: 80
doc_dir: /ansible/
doc_root: /var/www/html/
max_clients: 5
vars_prompt:
- name: username
prompt: What is your name? What is your Quest? What is your fav color?
tasks:
- name: Ensure that Apache is installed
yum: name=httpd state=present
when: ansible_os_family == "RedHat"
- name: Start Apache Services
service: name=httpd enabled=yes state=started
- name: Copy Site Files
template: src=templates/index.j2 dest={{ doc_root }}/index.html
notify:
- Restart Apache
handlers:
- name: Restart Apache
service: name=httpd state=restarted