Installing and configuring a web server

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 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 ...

Get Learning Ansible 2 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.