September 2018
Beginner to intermediate
214 pages
5h 53m
English
In this use case, we will use an Ansible playbook to automatically set up and configure some system services on multiple hosts. The following lines of code show how to make sure a service is installed and then how to carry out a configuration check to make sure it is well-configured. Finally, we start the service and enable it to start upon system startup:
---- name: Setup and configured recommended Linux services hosts: Linux become: yes gather_facts: yes tasks: - name: Install a list of services on Linux hosts package: name: '{{ item }}' state: latest with_items: - ntp - tzdate - autofs - name: Fix time zone on Red Hat 6 lineinfile: path: /etc/sysconfig/clock line: "ZONE='Europe/London'" state: ...Read now
Unlock full access