ansible.builtin.tower_inventory_source (v2.7.16) — module

create, update, or destroy Ansible Tower inventory source.

| "added in version" 2.7 of ansible.builtin"

Authors: Adrien Fleury (@fleu42)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.7.16

Description

Create, update, or destroy Ansible Tower inventories source. See U(https://www.ansible.com/tower) for an overview.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
name:
    description:
    - The name to use for the inventory source.
    required: true

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Desired state of the resource.
    required: false

source:
    choices:
    - file
    - scm
    - ec2
    - gce
    - azure
    - azure_rm
    - vmware
    - satellite6
    - cloudforms
    - openstack
    - rhv
    - tower
    - custom
    description:
    - Types of inventory source.
    required: true

timeout:
    description:
    - Number in seconds after which the Tower API methods will time out.

group_by:
    description:
    - 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.
    required: false

inventory:
    description:
    - The inventory the source is linked to.
    required: true

overwrite:
    description:
    - 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.
    required: false
    type: bool

credential:
    description:
    - Credential to use to retrieve the inventory from.
    required: false

description:
    default: null
    description:
    - The description to use for the inventory source.
    required: false

source_path:
    description:
    - Path to the file to use as a source in the selected *project*.
    required: false

source_vars:
    description:
    - '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.'
    required: false

source_script:
    description:
    - The source custom script to use to build the inventory. It needs to exist.
    required: false

overwrite_vars:
    description:
    - 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.
    required: false
    type: bool

source_project:
    description:
    - Use a *project* as a source for the *inventory*.
    required: false

source_regions:
    description:
    - 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.
    required: false

validate_certs:
    aliases:
    - tower_verify_ssl
    description:
    - Whether to allow insecure connections to AWX.
    - If C(no), SSL certificates will not be validated.
    - This should only be used on personally controlled sites using self-signed certificates.
    - If value not set, will try environment variable C(CONTROLLER_VERIFY_SSL) and then
      config files
    type: bool

controller_host:
    aliases:
    - tower_host
    description:
    - URL to your Automation Platform Controller instance.
    - If value not set, will try environment variable C(CONTROLLER_HOST) and then config
      files
    - If value not specified by any means, the value of C(127.0.0.1) will be used
    type: str

instance_filters:
    description:
    - 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.
    required: false

tower_verify_ssl:
    description:
    - Tower option to avoid certificates check.
    required: false
    type: bool

update_on_launch:
    description:
    - Each time a job runs using this inventory, refresh the inventory from the selected
      source before executing job tasks.
    required: false
    type: bool

controller_password:
    aliases:
    - tower_password
    description:
    - Password for your controller instance.
    - If value not set, will try environment variable C(CONTROLLER_PASSWORD) and then
      config files
    type: str

controller_username:
    aliases:
    - tower_username
    description:
    - Username for your controller instance.
    - If value not set, will try environment variable C(CONTROLLER_USERNAME) and then
      config files
    type: str

update_cache_timeout:
    description:
    - 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.
    required: false

controller_oauthtoken:
    aliases:
    - tower_oauthtoken
    description:
    - The OAuth token to use.
    - This value can be in one of two formats.
    - A string which is the token itself. (i.e. bqV5txm97wqJqtkxlMkhQz0pKhRMMX)
    - A dictionary structure as returned by the token module.
    - If value not set, will try environment variable C(CONTROLLER_OAUTH_TOKEN) and then
      config files
    type: raw
    version_added: 3.7.0
    version_added_collection: awx.awx

controller_config_file:
    aliases:
    - tower_config_file
    description:
    - Path to the controller config file.
    - If provided, the other locations for config files will not be considered.
    type: path

update_on_project_update:
    description:
    - That parameter will sync the inventory when the project is synced. It can only be
      used with a SCM source.
    required: false
    type: bool