W3cubDocs

/Ansible 2.9

tower_inventory_source – create, update, or destroy Ansible Tower inventory source

New in version 2.7.

Synopsis

Requirements

The below requirements are needed on the host that executes this module.

  • ansible-tower-cli >= 3.0.2

Parameters

Parameter Choices/Defaults Comments
credential
-
Credential to use to retrieve the inventory from.
description
-
The description to use for the inventory source.
group_by
-
Specify which groups to create automatically. Group names will be created similar to the options selected. If blank, all groups above are created. Refer to Ansible Tower documentation for more detail.
instance_filters
-
Provide a comma-separated list of filter expressions. Hosts are imported when all of the filters match. Refer to Ansible Tower documentation for more detail.
inventory
- / required
The inventory the source is linked to.
name
- / required
The name to use for the inventory source.
overwrite
boolean
    Choices:
  • no
  • yes
If set, any hosts and groups that were previously present on the external source but are now removed will be removed from the Tower inventory. Hosts and groups that were not managed by the inventory source will be promoted to the next manually created group or if there is no manually created group to promote them into, they will be left in the "all" default group for the inventory. When not checked, local child hosts and groups not found on the external source will remain untouched by the inventory update process.
overwrite_vars
boolean
    Choices:
  • no
  • yes
If set, all variables for child groups and hosts will be removed and replaced by those found on the external source. When not checked, a merge will be performed, combining local variables with those found on the external source.
source
- / required
    Choices:
  • file
  • scm
  • ec2
  • gce
  • azure
  • azure_rm
  • vmware
  • satellite6
  • cloudforms
  • openstack
  • rhv
  • tower
  • custom
Types of inventory source.
source_path
-
Path to the file to use as a source in the selected *project*.
source_project
-
Use a *project* as a source for the *inventory*.
source_regions
-
List of regions for your cloud provider. You can include multiple all regions. Only Hosts associated with the selected regions will be updated. Refer to Ansible Tower documentation for more detail.
source_script
-
The source custom script to use to build the inventory. It needs to exist.
source_vars
-
The source_vars allow to Override variables found in the source config file. For example with Openstack, specifying *private: false* would change the output of the openstack.py script. It has to be YAML or JSON.
state
-
    Choices:
  • present
  • absent
Desired state of the resource.
timeout
-
Number in seconds after which the Tower API methods will time out.
tower_config_file
path
Path to the Tower config file.
tower_host
string
URL to your Tower instance.
tower_password
string
Password for your Tower instance.
tower_username
string
Username for your Tower instance.
update_cache_timeout
-
Time in seconds to consider an inventory sync to be current. During job runs and callbacks the task system will evaluate the timestamp of the latest sync. If it is older than Cache Timeout, it is not considered current, and a new inventory sync will be performed.
update_on_launch
boolean
    Choices:
  • no
  • yes
Each time a job runs using this inventory, refresh the inventory from the selected source before executing job tasks.
update_on_project_update
boolean
    Choices:
  • no
  • yes
That parameter will sync the inventory when the project is synced. It can only be used with a SCM source.
validate_certs
boolean
    Choices:
  • no
  • yes
Tower option to avoid certificates check.

aliases: tower_verify_ssl

Notes

Note

  • If no config_file is provided we will attempt to use the tower-cli library defaults to find your Tower host information.
  • config_file should contain Tower configuration in the following format host=hostname username=username password=password

Examples

- name: Add tower inventory source
  tower_inventory_source:
    name: Inventory source
    description: My Inventory source
    inventory: My inventory
    credential: Devstack_credential
    source: openstack
    update_on_launch: true
    overwrite: true
    source_vars: '{ private: false }'
    state: present
    validate_certs: false

Status

Authors

  • Adrien Fleury (@fleu42)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/tower_inventory_source_module.html