citadel.nodes.ansible module

class citadel.nodes.ansible.Ansible(yml, path)[source]
Synopsis:

Run ansible-playbook.

Requirements:

None

Platform:

Any

Parameters:
  • inventory (required) – The inventory file.
  • playbook (required) – The playbook.

Usage

1
2
3
4
deploy:
  ansible:
    inventory: $ANSIBLE_HOME/inventory/development
    playbook: $ANSIBLE_HOME/playbooks/some_playbook.yml

The paths for both the inventory and playbook files may be hardcoded, but but the environment is expected to provide an ANSIBLE_HOME variable to be referenced from within the yaml.

Additional parameters may be specified and will be globbed up into the -e option of ansible-playbook’s CLI.

1
2
3
4
5
6
deploy:
  ansible:
    inventory: $ANSIBLE_HOME/development
    playbook: $ANSIBLE_HOME/playbooks/some_playbook.yml
    parameter: value
    another_parameter: value

Would be transformed into:

1
2
3
4
5
# Assumes ANSIBLE_HOME=/path/to
ansible-playbook -i /path/to/inventory/development \
    -e "parameter=value" \
    -e "another_parameter=value" \
    /path/to/playbooks/some_playbook.yml