According to
Ansible's Best Practices, There are many possible ways
to organize playbook content, and that the usage of such layout should fit your
needs. The only thing I highly recommend is using roles instead of
tasks, this will give your flexibility and better organization of your code.
Below is the
one of the best project structure for an complex Ansbile project.
ansible.cfg -> ansible.cfg file for this
project
production -> inventory file for production
environment
staging ->
inventory file for staging environment
group_vars
group1 -> assigning variables to particular groups
group2
hosts_vars
hostname1 -> If systems need specific variables,
put them here
hostname2
library ->
if any custom modules, put them here
module_utils ->
if any custom module_utils to support modules, put them here
filter_plugins ->
If any custom filter plugins, put them here
roles
role_name
tasks
main.yml -> list of tasks
handlers
main.yml -> handlers file
templates -> files for use with
template resource
ntp.conf.j2 -> template file end with .j2
files
*.txt -> files to use in this
role
vars
main.yml -> variables associated with this
role
defaults
main.yml -> default variables for this role
meta/
main.yml -> role dependencies
project.yml ->
master playbook to call roles, group vars, handlers
In the Next tutorial we will discuss Ansible roles and a sample Ansbile project to install and configure Weblogic 12C on CentOS7/RHEL7 machine.
<< Previous Next >>
No comments:
Post a Comment