Question 16

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 templatecalledindex.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 theip address of the node using ansible facts. Lastly, create a playbook in and use the role to serve the index file on webserver hosts.

Question 17

Create a jinja template in /home/sandy/ansible/ and name it hosts.j2. Edit this file so it looks like the one below. The order of the nodes doesn't matter. Then create a playbook in /home/sandy/ansible called hosts.yml and install the template on dev node at /root/myhosts

Question 18

What formats may variables specified on the command line use when not using a file with the -e flag? (Choose all that apply.)
  • Question 19

    Create an ansible vault password file called lock.yml with the password reallysafepw in the
    /home/sandy/ansible directory. In the lock.yml file define two variables. One is pw_dev and the password is
    'dev' and the other is pw_mgr and the password is 'mgr' Create a regular file called secret.txt which contains the password for lock.yml.

    Question 20

    Is there a syntax error in the following excerpt? If so, what is it?
    vars:
    package: httpd
    tasks:
    - name: Deploy {{ package }}
    yum:
    name:
    {{ package }}
    state: present