Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ansible: 10 tips and tricks

Ansible: 10 tips and tricks

Tips and tricks for Ansible. Code at git.io/pK57

Steven Ringo

March 12, 2015
Tweet

More Decks by Steven Ringo

Other Decks in Programming

Transcript

  1. !"" inventory # !"" _common # # $"" inventory #

    !"" production # # !"" group_vars # # # $"" all # # !"" host_vars # # $"" inventory -> ../_common/inventory # $"" staging # !"" group_vars # # $"" all # !"" host_vars # $"" inventory -> ../_common/inventory
  2. pre_tasks: - remove host from load balancer pool roles: -

    rails tasks: - do stuff post_tasks: - return load balancer back to pool
  3. pre_tasks: - remove host from load balancer pool tasks: -

    do stuff - role: nginx - do more other stuff - role: rails post_tasks: - return load balancer back to pool
  4. - name: copy something template: src: "templates/config.j2" dest: "/home/{{ deploy_user

    }}/config" owner: "{{ deploy_user }}" group: "{{ deploy_user }}" mode: 0755
  5. - name: decrypt the key on the server sudo_user: "{{

    deploy_key_user }}" command: > openssl rsa -in {{ deploy_key_path }}.protected -out {{ deploy_key_path }} -passin pass:{{ deploy_key_secret }}