Ansible Playbook structure is defined in official documentation but the recommended way to group hosts and apply roles is something that each user would have to decide for itself.
Define and apply a company-wide consistent structure for all your Ansible Playbooks that allows for easy understanding and maximum reutilization.
Folder | Description |
---|---|
group_vars\all | Contains default values for variables that will be applied to all hosts, independently from its membership to other groups. |
group_vars\tag_app_wp | Contains values to variables from hosts in group tag_app_wp (AWS tag app=wp). |
group_vars\tag_environment_pre | Contains values to variables from hosts in group tag_environment_pre (AWS tag environment=pre). |
group_vars\tag_environment_pro | Contains values to variables from hosts in group tag_environment_pre (AWS tag environment=pro). |
inventory | Since we are using Ansible Dynamic Inventory, it has the ec2.ini and ec2.py files. |
roles\ | Root roles directory |
roles\linux\add_packages | Role to install WordPress |
roles\linux\host_name | Role to set the hostname of the instance |
roles\linux\hosts_file | Role to modify local hosts file for resolver |
roles\linux\pam_limits | Role to set various pam limits for kernel configuration |
roles\linux\wordpress | Role to install WordPress |
ansible.cfg | Local ansible configuration |
ditwl_pro.sh | Sets environment variables for PRO environment |
ditwl_pro.yml | Playbook for PRO environment |
IT Wonder Lab tutorials are based on the diverse experience of Javier Ruiz, who founded and bootstrapped a SaaS company in the energy sector. His company, later acquired by a NASDAQ traded company, managed over €2 billion per year of electricity for prominent energy producers across Europe and America. Javier has over 25 years of experience in building and managing IT companies, developing cloud infrastructure, leading cross-functional teams, and transitioning his own company from on-premises, consulting, and custom software development to a successful SaaS model that scaled globally.
Are you looking for cloud automation best practices tailored to your company?