Create task to install ntpd on CentOS
Create task to start ntpd on CentOS
Create a task to install httpd and httpd-devel on CentOS
-yum:
name:
-httpd
-httpd-devel
state: presentCreate task to copy following files, setting permissions to 644 and group to root and user to root:
httpd.conf to /etc/httpd/conf/httpd.conf
httpd-vhosts.conf to /etc/httpd/conf/httpd-vhosts.conf
-copy:
src: {{item}}
dest: “/etc/httpd/conf/”{{item}}
owner: root
group: root
mode: 644
with_items:
- httpd.conf
- httpd-vhosts.conf
How do you specify the user a playbook should be run as?
ansible-playbook playbook.yml –remote-user=johndoe
How do you define variables when running the play book?
ansible-playbook playbook.yml –extra-vars=”key=value,key=value”
A complete playbook that defines a variable “index.html” and installs nginx
Task to ensure firewalld is stoped
-yum: name=firewalld state=stopped
Create a playbook that logs in as root and installs haproxy using role haproxy.
Create a playbook that logs in as root and installs mysql and mysqladmin using roles with same names.