Chapter 31. Best practices for automation controller
Chapter 31. Best practices for automation controller The following describes best practice for the use of automation controller: 31.1. Use Source Control Automation controller supports playbooks stored directly on the server. Therefore, you must store your playbooks, roles, and any associated details in source control. This way you have an audit trail describing when and why you changed the rules that are automating your infrastructure. Additionally, it permits sharing of playbooks with other parts of your infrastructure or team. 31.2. Ansible file and directory structure If you are creating a common set of roles to use across projects, these should be accessed through source control submodules, or a common location such as /opt . Projects should not expect to import roles or content from other projects. For more information, see the link General tips from the Ansible documentation. Note Avoid using the playbooks vars_prompt feature, as automation controller does not interactively permit vars_prompt questions. If you cannot avoid using vars_prompt , see the Surveys functionality. Avoid using the playbooks pause feature without a timeout, as automation controller does not permit canceling a pause interactively. If you cannot avoid using pause , you must set a timeout. Jobs use the playbook directory as the current working directory, although jobs must be coded to use the playbook_dir variable rather than relying on this. 31.3. Use Dynamic Inventory Sources If you have an external source of truth for your infrastructure, whether it is a cloud provider or a local CMDB, it is best to define an inventory sync process and use the support for dynamic inventory (including cloud inventory sources). This ensures your inventory is always up to date. Note Edits and additions to Inventory host variables persist beyond an inventory synchronization as long as --overwrite_vars is not set. 31.4. Variable Management for Inventory Keep variable data with the hosts and groups definitions (see the inventory editor), rather than using group_vars/ and host_vars/ . If you use dynamic inventory sources, automation controller can synchronize such variables with the database as long as the Overwrite Variables option is not set. 31.5. Autoscaling Use the "callback" feature to permit newly booting instances to request configuration for auto-scaling scenarios or provisioning integration. 31.6. Larger Host Counts Set "forks" on a job template to larger values to increase parallelism of execution runs. For more information on tuning Ansible, see the Ansible blog . 31.7. Continuous integration / Continuous Deployment For a Continuous Integration system, such as Jenkins, to spawn a job, it must make a curl request to a job template. The credentials to the job template must not require prompting for any particular passwords. For configuration and use instructions, see Installation in the Ansible documentation.