Hi All

First off, I LOVE ansible, its awesome! Really didn't like puppet when I 
tried it.

Just wanted to share a nice pattern I found for making it easy to run only 
part of a playbook, without having to remember which tags to use with the 
--tags option. (apologies if something similar has been posted before!)

With the below code at the top of the playbook, when you run it with 
ansible-playbook, you are first presented with an options menu asking you 
what you want to do :)


- name: My awesome playbook with options menu :)

  vars_prompt:
    update_option: |
      This playbook updates LIVE SYSTEMS. Use with caution!

      Please enter one of the following options to perform the update:
        app_update  - check / update application software only
        nginx       - check / update nginx configuration
        backup      - check / update backup configuration
        all         - check / update all items

      Or press CTRL+C to Cancel!

  roles:
  - { role: my_app_role,              when: "update_option in 
['app_update', 'all']" }
  - { role: my_app_other_role,        when: "update_option in 
['app_update', 'all']" }
  - { role: nginx,                    when: "update_option in ['nginx', 
'all']" }
  - { role: app_backup,               when: "update_option in ['backup', 
'all']" }

Cheers all!

Russell Briggs
(Junari Ltd)

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2a1c4b41-13ab-44db-be86-0d512f39a4d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to