Create a file calledrequirements.ymlin/home/sandy/ansible/rolesa file calledrole.yml in /home/sandy/ansible/.Thehaproxy-roleshould be used on theproxyhost. And when you curlhttp://node3.example.com it should display "Welcome tonode4.example.com" and when you curl again "Welcome tonode5.example.com" Thephp-roleshould be used on theprodhost.
Create a role called sample-apache in/home/sandy/ansible/rolesthat enables and starts httpd, enables and starts the firewall and allows the webserver service. Create a template calledindex.html.j2which creates and serves a message from/var/www/html/index.htmlWhenever the content of the file changes, restart the webserver service.
Welcome to [FQDN] on [IP]
Replace the FQDN with the fully qualified domain name and IP with the ip address of the node using ansible facts. Lastly, create a playbook in/home/sandy/ansible/calledapache.ymland use the role to serve the index file on webserver hosts.
Create a file called mysecret.yml on the control host using ansible vault in home/bob/ansible. Set the password to 'notasafepass' and inside the file create avariable called dev_pass with the value of devops. Save the file. Then go back in the file and change dev_pass value to devops123. Then change the vault password of mysecret.yml to verysafepass
Create a file calledpackages.yml in/home/sandy/ansibleto install some packages for the following hosts. On dev, prod and webservers install packages httpd, mod_ssl, and mariadb. On dev only install the development tools package. Also, on dev host update all the packages tothe latest.