Now that we have made some generic changes to the operating system, let's move on to actually creating a web server. We are splitting those two phases so that we can share the first phase between every machine and apply the second only to web servers.
For this second phase, we will create a new playbook called webserver.yaml with the following content:
---
- hosts: all
remote_user: ansible
tasks:
- name: Ensure the HTTPd package is installed
yum:
name: httpd
state: present
become: True
- name: Ensure the HTTPd service is enabled and running
service:
name: httpd
state: started
enabled: True
become: True
- name: Ensure HTTP can pass the firewall
firewalld:
service: http
state: enabled
permanent: True
immediate: True
...