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 Default:
None
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
bool
    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
bool
    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 to the Tower config file. See notes.
tower_host
URL to your Tower instance.
tower_password
Password for your Tower instance.
tower_username
Username for your Tower instance.
tower_verify_ssl
bool
    Choices:
  • no
  • yes ←
Tower option to avoid certificates check.
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
bool
    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
bool
    Choices:
  • no
  • yes
That parameter will sync the inventory when the project is synced. It can only be used with a SCM source.

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
    tower_verify_ssl: false

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Adrien Fleury (@fleu42)

Hint

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