Automate SELinux Settings
Production must serve the content in `/web` on port 82 with SELinux enforcing. Someone left every node permissive in `/etc/selinux/config`. `ansible.posix` and `community.general` are installed in `~/ansible/collections`. Use the SELinux modules, as on the exam: `community.general.sefcontext`, `ansible.posix.seboolean` and `community.general.seport` (the nodes run the WebAsha SELinux simulator, which these modules use like the real thing).
Tasks
- Write ~/ansible/selinux.yml: on all nodes set SELinux to enforcing with the targeted policy persistently.
- Write ~/ansible/webcontent.yml: on prod, add a persistent file-context rule /web(/.)? → httpdsyscontentt and apply it to the existing files.
- Add to webcontent.yml: turn the boolean httpdcannetworkconnect on, now and persistently, on prod only.
- Add to webcontent.yml: label TCP port 82 as httpportt on prod.
- Write ~/ansible/web82.yml: on prod, httpd listens on port 82 with DocumentRoot /web (file /etc/httpd/conf.d/web82.conf), port 82/tcp is open in firewalld (permanent + runtime) and httpd is restarted and enabled. curl http://node3:82/ from control must return the page in /web. Use modules only.