Open main menu

CDOT Wiki β

Changes

OPS635-lab-ansible

448 bytes added, 18:28, 12 February 2020
m
Added an investigation with one-off ansible commands
In an enterprise environment, the existence of different hardware and operating systems running on production servers is very common. You may find the same software running on different OSes and even different hardware platforms. To manage the software configuration on different platforms by using a script, your script would have to be aware of and account for their differences. Your scripts would need to be written in way that they know how to query the operating environment and execute the appropriate installation and configuration actions based on the operating environment it is running on.
There are commercial and open source configuration management systems which aware of and know how to handle such difference in operating platforms. '''Ansible''' is a one such CMS (Content Management System) that we are going to study for this lab. In this lab, we you will start by trying to convert gain experience using the script that you have written for configuring Nagios on CentOS 7 to an Ansible playbook, test it on your testing environment and then deploy it basic features of ansible to a new VMremotely configure other machines.
==Investigation 1: Installing Ansible==
*Install Ansible on one of your VMs (we will refert refer to that as the server).*If you have not already done so, create an SSH key-pair for the '''root user on your server''' and transfer the public portion of it to another VM (we will refer to it as the client). Ensure that you can use it to ssh to root on the other VM client without entering a password.
*Modify the inventory file on your server to include the fully qualified domain names of client VM.
*Use the '''setup module''' to verify that your Ansible server can run plays on your client VM.
==Investigation 2: Running Single Ansible Commands==*Use the ansible command on your server to make sure the client meets the following conditions:**The bind-utils package is fully up-to-date.**The firewall-cmd service is running and enabled.**Firewalld is not allowing the mdns or cockpit services. Remember to also make this permanent.*Use the terminal on to confirm these changes worked.*While these changes are not important to the service you will configure using a playbook in the next investigation, they give you some experience using one-off commands in ansible. ==Investigation 3: Creating an Ansible Playbook==
*Create an ansible playbook to make your client machine meet the following conditions:
**The httpd package must be installed
*Break your machine (e.g. modify the configuration file), then re-run your play and ensure it fixes your machine.
==Investigation 34: Advanced Playbook Options==
*Add a handler to your playbook to re-start the httpd service when changes to the configuration file are discovered.
*Replace the configuration file with a template and provide at least one variable to it.
932
edits