Skip to content

Instantly share code, notes, and snippets.

@aweiteka
Last active August 11, 2017 15:24
Show Gist options
  • Select an option

  • Save aweiteka/7e5d047d92b6dfed49dc391a525b9733 to your computer and use it in GitHub Desktop.

Select an option

Save aweiteka/7e5d047d92b6dfed49dc391a525b9733 to your computer and use it in GitHub Desktop.
APB development good practice

Ansible Playbook Bundle (APB) Good Practices

Development and maintainence

  • When developing an APB with an existing template, keep parameters the same as the template.
  • All end-user parameter defaults should be defined in apb.yml.
  • All parameter defaults defined in nested directories (e.g. roles/provision/defaults/main.yml) should be considered application constants that the end-user is not expected to alter. These are values that are proliferated throughout the playbook but are not exposed to the end-user.
  • Keep it simple
    • Do not use jinja2-style template files unless absolutely necessary
    • Use a common set of kubernetes/openshift resources where the state is parameterized based on provision or deprovision playbook.

Testing

  • All APBs should have a standard test entrypoint. Options include:
    • Makefile, e.g. make test
    • test playbook playbooks/test.yml
  • The local test should provide user-defined defaults of params defined in apb.yml. This helps ensure testing is using the user-defined params that would be provided in apb.yml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment