RH294 Ch 3: Write and Run Playbooks

The project in `~/ansible` is ready (inventory groups `dev`=node1, `test`=node2, `prod`=node3+node4, `webservers` contains `prod`; ansible.cfg and ansible-navigator.yml exist). Write playbooks that build the web servers and an admin account, and run them with ansible-navigator and ansible-playbook.

Tasks

  1. Write ~/ansible/web.yml, a play for webservers, that installs the httpd and firewalld packages (module ansible.builtin.dnf). Check it with ansible-navigator run web.yml --syntax-check and run it.
  2. Extend web.yml: /var/www/html/index.html on the web servers contains exactly Welcome to WebAsha (module copy).
  3. Extend web.yml: httpd and firewalld are started and enabled at boot (module service).
  4. Extend web.yml: the http service is allowed through firewalld, permanently and immediately (module ansible.posix.firewalld, which ships in the execution environment, so run web.yml with ansible-navigator).
  5. Write ~/ansible/users.yml for the dev group that creates user webadmin with UID 2001 and supplementary group wheel. Run it with ansible-playbook.
  6. web.yml is idempotent: running it again reports changed=0 and no failures.