Skip to content

Instantly share code, notes, and snippets.

@carlessanagustin
Last active July 17, 2019 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carlessanagustin/d13c0ccbd290c395f37c33dc2911e984 to your computer and use it in GitHub Desktop.
Save carlessanagustin/d13c0ccbd290c395f37c33dc2911e984 to your computer and use it in GitHub Desktop.
Ansible best practices for startups to enterprises

Ansible best practices for startups to enterprises

Project layouts: basic

└── basic_project
    ├── config.yml
    ├── inventory
    │   ├── group_vars
    │   ├── hosts
    │   └── host_vars
    ├── provision.yml
    └── site.yml

Project layouts: shared roles

└── shared_project
    ├── config.yml
    ├── provision.yml
    ├── roles
    │   └── requirements.yml
    └── setup.yml

Separate tasks

└── tasks
    ├── configure.yml
    ├── deploy.yml
    └── provision.yml

$ cat tasks/deploy.yml
---
- include: provision.yml
- include: configure.yml

Smoke tests

- name: check for proper response
  uri:
    url: http://localhost/myapp
    return_content: yes
  register: result
  until: '"Hello World" in result.content'
  retries: 10
  delay: 1

Templates

Extending

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment