O'Reilly logo

Learning Ansible 2 - Second Edition by Fabio Alessandro Locati

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required