I've got a number of ansible playbooks that I come back to from time to time, some have required and optional arguments that I forget about from time to time.
I know there's a list-tags, list-hosts and list-tasks option baked into the ansible-playbook command, there's no list-args, which would be super useful, but maybe it means I'm using ansible wrong?
So what strategies do devops engineers use to manage "api's" for ansible playbooks? Maybe just a recursive grep command to list non-standard args that aren't registered variables like this
grep -or "{{[a-zA-Z_ ]\+}}" roles/. | grep -v "ansible" | grep -v "item"
only better.
For instance, I've got a program I want to put on a device called "showstopper", but I specify the version with extra_args and if I don't specify the version, it doesn't get installed.
- name: download showstopper from artifactory
local_action: get_url url=https://example.net/artifactory/generic-release-local/com/cdw/mans/silo/showstopper/showstopper-{{ showstopper_version }}.noarch.rpm dest=/tmp validate_certs=no
run_once: true
when: showstopper_version is defined
- name: copy showstopper to silo
copy: src=/tmp/showstopper-{{ showstopper_version }}.noarch.rpm dest=/tmp
when: showstopper_version is defined
- name: Install showstopper
yum: name=/tmp/showstopper-{{ showstopper_version }}.noarch.rpm state=present
notify:
- start cron
when: showstopper_version is defined
This works good when I run it the way I intended to run it, but in 2 months when I want to run it on another machine, I forgot to specify showstopper_version and the last few machines I've built went out without that configured on it.