# salt.modules.ansiblegate

## 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.

salt.modules.ansiblegate.call(module, *args, **kwargs)

  Call an Ansible module by invoking it.

  Parameters:

    - module -- the name of the module.

    - args -- Arguments to pass to the module

    - kwargs -- keywords to pass to the module

  CLI Example:

      salt * ansible.call ping data=foobar

salt.modules.ansiblegate.discover_playbooks(path=None, locations=None, playbook_extension=None, hosts_filename=None, syntax_check=False)

  New in version 3005.

  Discover Ansible playbooks stored under the given path or from multiple paths (locations)

  This will search for files matching with the playbook file extension under the given root path and will also look for files inside the first level of directories in this path.

  The return of this function would be a dict like this:

      {
          "/home/foobar/": {
              "my_ansible_playbook.yml": {
                  "fullpath": "/home/foobar/playbooks/my_ansible_playbook.yml",
                  "custom_inventory": "/home/foobar/playbooks/hosts"
              },
              "another_playbook.yml": {
                  "fullpath": "/home/foobar/playbooks/another_playbook.yml",
                  "custom_inventory": "/home/foobar/playbooks/hosts"
              },
              "lamp_simple/site.yml": {
                  "fullpath": "/home/foobar/playbooks/lamp_simple/site.yml",
                  "custom_inventory": "/home/foobar/playbooks/lamp_simple/hosts"
              },
              "lamp_proxy/site.yml": {
                  "fullpath": "/home/foobar/playbooks/lamp_proxy/site.yml",
                  "custom_inventory": "/home/foobar/playbooks/lamp_proxy/hosts"
              }
          },
          "/srv/playbooks/": {
              "example_playbook/example.yml": {
                  "fullpath": "/srv/playbooks/example_playbook/example.yml",
                  "custom_inventory": "/srv/playbooks/example_playbook/hosts"
              }
          }
      }

  Parameters:

    - path -- Path to discover playbooks from.

    - locations -- List of paths to discover playbooks from.

    - playbook_extension -- File extension of playbooks file to search for. Default: "yml"

    - hosts_filename -- Filename of custom playbook inventory to search for. Default: "hosts"

    - syntax_check -- Skip playbooks that do not pass "ansible-playbook --syntax-check" validation. Default: False

  Returns:

    The discovered playbooks under the given paths

  CLI Example:

      salt 'ansiblehost' ansible.discover_playbooks path=/srv/playbooks/
      salt 'ansiblehost' ansible.discover_playbooks locations='["/srv/playbooks/", "/srv/foobar"]'

salt.modules.ansiblegate.help(module=None, *args)

  Display help on Ansible standard module.

  Parameters:

    module -- The module to get the help

  CLI Example:

      salt * ansible.help ping

salt.modules.ansiblegate.list_(pattern=None)

  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

  Parameters:

    - 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)

  Param:

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

  Returns:

    Playbook return

  CLI Example:

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

salt.modules.ansiblegate.targets(inventory='/etc/ansible/hosts', yaml=False, export=False)

  New in version 3005.

  Return the inventory from an Ansible inventory_file

  Parameters:

    - inventory -- The inventory file to read the inventory from. Default: "/etc/ansible/hosts"

    - yaml -- Return the inventory as yaml output. Default: False

    - export -- Return inventory as export format. Default: False

  CLI Example:

      salt 'ansiblehost' ansible.targets
      salt 'ansiblehost' ansible.targets inventory=my_custom_inventory