Ansible – My Journey – Part 3

Understanding File Structure and Files

In order to get ansible to run you need playbooks. I have a basic setup and follow a very simple file structure. Here is what my structure looks like. If you installed from my blog then the some of these files and folders will be under /etc/ansible/

The first file we will focus on is the hosts file. The file will look something like this. The host file serves as a list of devices that you want to manage and are called out during the playbooks.

Items to know

  • Group names must be between []
  • Devices can be part of multiple groups
  • Can use IP or full FQDN. FQDN should use upper case letters for domain

Next folder we will look at is /etc/ansible/group_vars/
This folder has YAML files that can contain usernames and password.
(NOTE: These files should be encrypted if they contain passwords)
The file names should match that of the groups that you put in the HOSTS file.

Here is an example of a Group_Vars YMAL file

With these basic files you should be now ready to create a basic playbook. In my next blog I will detail out a basic playbook.

Please note that there is plenty of information on the Ansible Website that will help you get started and add even more detail.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s