Ansible Support

This module can have an optional minion-level configuration in /etc/salt/minion.d/ as follows:

ansible_timeout: 1200

The timeout is how many seconds Salt should wait for any Ansible module to respond., *args, **kwargs)

Call an Ansible module by invoking it.

  • module -- the name of the module.

  • args -- Arguments to pass to the module

  • kwargs -- keywords to pass to the module

CLI Example:

salt * ping data=foobar, *args)

Display help on Ansible standard module.


module -- The module to get the help

CLI Example:

salt * ping

Lists available modules.

CLI Example:

salt * ansible.list
salt * ansible.list '*win*'  # To get all modules matching 'win' on it's name
salt.modules.ansiblegate.playbooks(playbook, rundir=None, check=False, diff=False, extra_vars=None, flush_cache=False, forks=5, inventory=None, limit=None, list_hosts=False, list_tags=False, list_tasks=False, module_path=None, skip_tags=None, start_at_task=None, syntax_check=False, tags=None, playbook_kwargs=None)

Run Ansible Playbooks

  • playbook -- Which playbook to run.

  • rundir -- Directory to run ansible-playbook in. (Default: None)

  • check -- don't make any changes; instead, try to predict some of the changes that may occur (Default: False)

  • diff -- when changing (small) files and templates, show the differences in those files; works great with --check (default: False)

  • extra_vars -- set additional variables as key=value or YAML/JSON, if filename prepend with @, (default: None)

  • flush_cache -- clear the fact cache for every host in inventory (default: False)

  • forks -- specify number of parallel processes to use (Default: 5)

  • inventory -- specify inventory host path or comma separated host list. (Default: None) (Ansible's default is /etc/ansible/hosts)

  • limit -- further limit selected hosts to an additional pattern (Default: None)

  • list_hosts -- outputs a list of matching hosts; does not execute anything else (Default: False)

  • list_tags -- list all available tags (Default: False)

  • list_tasks -- list all tasks that would be executed (Default: False)

  • module_path -- prepend colon-separated path(s) to module library. (Default: None)

  • skip_tags -- only run plays and tasks whose tags do not match these values (Default: False)

  • start_at_task -- start the playbook at the task matching this name (Default: None)

  • tags -- only run plays and tasks tagged with these values (Default: None)


syntax_check: perform a syntax check on the playbook, but do not execute it (Default: False)


Playbook return

CLI Example:

salt 'ansiblehost'  ansible.playbook playbook=/srv/playbooks/play.yml