oracle.oci.oci (5.0.0) — inventory

Oracle Cloud Infrastructure (OCI) inventory plugin

Authors: unknown

Install collection

Install with ansible-galaxy collection install oracle.oci:==5.0.0


Add to requirements.yml

  collections:
    - name: oracle.oci
      version: 5.0.0

Description

Get inventory hosts from oci.

Uses a <name>.oci.yaml (or <name>.oci.yml) YAML configuration file.

Inputs

    
cache:
    default: false
    description:
    - Toggle to enable/disable the caching of the inventory's source data, requires a
      cache plugin setup to work.
    env:
    - name: ANSIBLE_INVENTORY_CACHE
    ini:
    - key: cache
      section: inventory
    type: bool

debug:
    description: Parameter to enable logs while running the inventory plugin. Default
      value is set to False
    type: boolean

groups:
    default: {}
    description: Add hosts to group based on Jinja2 conditionals.
    type: dict

plugin:
    choices:
    - oracle.oci.oci
    description: token that ensures this is a source file for the 'oci' plugin.
    required: true

strict:
    default: false
    description:
    - If V(yes) make invalid entries a fatal error, otherwise skip and continue.
    - Since it is possible to use facts in the expressions they might not always be available
      and we ignore those errors by default.
    type: bool

compose:
    default: {}
    description: Create vars from jinja2 expressions.
    type: dict

filters:
    description:
    - A dictionary of filter value pairs.
    - Available filters are display_name, lifecycle_state, availability_domain, defined_tags,
      freeform_tags.
    - 'Note: defined_tags and freeform_tags filters are not supported for db hosts. The
      db hosts will not be returned when you use either of these filters.'
    type: list

regions:
    description: A list of regions to search. If not specified, the region is read from
      config file. Use 'all' to generate inventory from all subscribed regions.
    type: list

auth_type:
    choices:
    - api_key
    - instance_principal
    - instance_obo_user
    - resource_principal
    - security_token
    default: api_key
    description:
    - The type of authentication to use for making API requests. By default C(auth_type="api_key")
      based authentication is performed and the API key (see I(api_user_key_file)) in
      your config file will be used. If this 'auth_type' module option is not specified,
      the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use C(auth_type="instance_principal")
      to use instance principal based authentication when running ansible playbooks within
      an OCI compute instance.
    env:
    - name: OCI_ANSIBLE_AUTH_TYPE
    type: str

hostnames:
    description: A list of hostnames to search for.
    type: list

config_file:
    default: ~/.oci/config
    description: The oci config path. Either pass the '/full/path/to/config/file' in inventory
      plugin configuration file. Or pass the 'relative/path/to/config/file' with respect
      to the directory from where inventory command is executed. Relative path should
      not be relative with respect to inventory plugin configuration file.
    env:
    - name: OCI_CONFIG_FILE

enable_ipv6:
    default: true
    description: Fetch IPv6 address information from VNICs. Default value set to True.
    type: bool

cache_plugin:
    default: memory
    description:
    - Cache plugin to use for the inventory's source data.
    env:
    - name: ANSIBLE_CACHE_PLUGIN
    - name: ANSIBLE_INVENTORY_CACHE_PLUGIN
    ini:
    - key: fact_caching
      section: defaults
    - key: cache_plugin
      section: inventory
    type: str

cache_prefix:
    default: ansible_inventory_
    description:
    - Prefix to use for cache plugin files/tables
    env:
    - name: ANSIBLE_CACHE_PLUGIN_PREFIX
    - name: ANSIBLE_INVENTORY_CACHE_PLUGIN_PREFIX
    ini:
    - key: fact_caching_prefix
      section: defaults
    - key: cache_prefix
      section: inventory

compartments:
    description: A dictionary of compartment identifier to obtain list of hosts. This
      config parameter is optional. If compartment is not specified, the plugin fetches
      all compartments from the tenancy.
    suboptions:
      compartment_name:
        description: Name of the compartment. If None and `compartment_ocid` is not set,
          all the compartments including the root compartment are returned.
        type: str
      compartment_ocid:
        description: OCID of the compartment. If None, root compartment is assumed to
          be the default value.
        type: str
      fetch_hosts_from_subcompartments:
        description: Flag used to fetch hosts from subcompartments. Default value is set
          to True
        type: boolean
      parent_compartment_ocid:
        description: This option is not needed when the compartment_ocid option is used,
          it is needed when compartment_name is used. OCID of the parent compartment.
          If None, root compartment is assumed to be parent.
        type: str
    type: list

keyed_groups:
    default: []
    description: Add hosts to group based on the values of a variable.
    elements: dict
    suboptions:
      default_value:
        description:
        - The default value when the host variable's value is an empty string.
        - This option is mutually exclusive with O(keyed_groups[].trailing_separator).
        type: str
        version_added: '2.12'
        version_added_collection: ansible.builtin
      key:
        description:
        - The key from input dictionary used to generate groups
        type: str
      parent_group:
        description: parent group for keyed group
        type: str
      prefix:
        default: ''
        description: A keyed group name will start with this prefix
        type: str
      separator:
        default: _
        description: separator used to build the keyed group name
        type: str
      trailing_separator:
        default: true
        description:
        - Set this option to V(False) to omit the O(keyed_groups[].separator) after the
          host variable when the value is an empty string.
        - This option is mutually exclusive with O(keyed_groups[].default_value).
        type: bool
        version_added: '2.12'
        version_added_collection: ansible.builtin
    type: list

cache_timeout:
    default: 3600
    description:
    - Cache duration in seconds
    env:
    - name: ANSIBLE_CACHE_PLUGIN_TIMEOUT
    - name: ANSIBLE_INVENTORY_CACHE_TIMEOUT
    ini:
    - key: fact_caching_timeout
      section: defaults
    - key: cache_timeout
      section: inventory
    type: int

config_profile:
    default: DEFAULT
    description: The config profile to use.
    env:
    - name: OCI_CONFIG_PROFILE

default_groups:
    description: OCI Inventory plugin creates some groups by default based on these properties
      ["availability_domain", "compartment_name", "region", "freeform_tags", "defined_tags"].
      If you don't want OCI inventory plugin to create these default groups, you can use
      this option to configure which of these default groups should be created. This option
      takes a list of properties of inventory hosts based on which the groups will be
      created. The supported properties are - "availability_domain" - "compartment_name"
      - "region" - "freeform_tags" - "defined_tags" if empty list is passed to this option,
      none of the default groups are created. default_groups and default_groups_preferences
      cannot be used together We recommend to use default_groups_preferences parameter
      as we will deprecate default_groups parameter in our next major upgrade
    type: list

fetch_db_hosts:
    description: When set, the db nodes are also fetched. Default value set to False.
    type: bool

use_extra_vars:
    default: false
    description: Merge extra vars into the available variables for composition (highest
      precedence).
    env:
    - name: ANSIBLE_INVENTORY_USE_EXTRA_VARS
    ini:
    - key: use_extra_vars
      section: inventory_plugins
    type: bool
    version_added: '2.11'
    version_added_collection: ansible.builtin

hostname_format:
    description: Host naming format to use. Use 'fqdn' to list hosts using the instance's
      Fully Qualified Domain Name (FQDN). These FQDNs are resolvable within the VCN using
      the VCN resolver specified through the subnet's DHCP options. Please see https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm
      for more details. Use 'public_ip' to list hosts using public IP address. Use 'private_ip'
      to list hosts using private IP address. Use 'display_name' to list hosts using display_name
      of the Instances. 'display_name' cannot be used when fetch_db_hosts is True. By
      default, hosts are listed using public IP address. hostname_format_preferences and
      hostname_format cannot be used together
    env:
    - name: OCI_HOSTNAME_FORMAT

cache_connection:
    description:
    - Cache connection data or path, read cache plugin documentation for specifics.
    env:
    - name: ANSIBLE_CACHE_PLUGIN_CONNECTION
    - name: ANSIBLE_INVENTORY_CACHE_CONNECTION
    ini:
    - key: fact_caching_connection
      section: defaults
    - key: cache_connection
      section: inventory
    type: str

api_user_key_file:
    description: Full path and filename of the private key (in PEM format). If the key
      is encrypted with a pass-phrase, the pass_phrase option must also be provided. Preference
      order is .oci.yml > OCI_USER_KEY_FILE environment variable > settings from config
      file This option is required if the private key is not specified through a configuration
      file (See config_file)
    env:
    - name: OCI_USER_KEY_FILE
    type: str

leading_separator:
    default: true
    description:
    - Use in conjunction with keyed_groups.
    - By default, a keyed group that does not have a prefix or a separator provided will
      have a name that starts with an underscore.
    - This is because the default prefix is "" and the default separator is "_".
    - Set this option to False to omit the leading underscore (or other separator) if
      no prefix is given.
    - If the group name is derived from a mapping the separator is still used to concatenate
      the items.
    - To not use a separator in the group name at all, set the separator for the keyed
      group to an empty string instead.
    type: boolean
    version_added: '2.11'
    version_added_collection: ansible.builtin

primary_vnic_only:
    description: The default behavior of the plugin is to process all VNIC's attached
      to a compute instance. This might result in instance having multiple entries. When
      this parameter is set to True, the plugin will only process the primary VNIC and
      thus having only a single entry for each compute instance.
    env:
    - name: OCI_PRIMARY_VNIC_ONLY
    type: bool

fetch_compute_hosts:
    description: When set, the compute nodes are fetched. Default value set to True.
    type: bool

exclude_compartments:
    description: A dictionary of compartment identifier to filter the compartments from
      which  hosts should be listed from. This config parameter is optional. Suboption
      is not considered when both compartment_ocid, compartment_name are None
    suboptions:
      compartment_name:
        description: Name of the compartment. If None and `compartment_ocid` is not set,
          this option is not considered for filtering the compartments. If both compartment_ocid
          and compartment_name are passed, compartment_ocid is considered
        type: str
      compartment_ocid:
        description: OCID of the compartment.
        type: str
      parent_compartment_ocid:
        description: This option is not needed when the compartment_ocid option is used,
          it is needed when compartment_name is used. OCID of the parent compartment.
          If None, root compartment is assumed to be parent.
        type: str
      skip_subcompartments:
        description: Flag used to skip the sub-compartments. Default value is set to True
        type: boolean
    type: list

exclude_host_filters:
    description: A list of Jinja2 conditional expressions. Each expression in the list
      is evaluated for each host; when any of the expressions is evaluated to Truthy value,
      the host is excluded from the inventory. exclude_host_filters take priority over
      the include_host_filters and filters.
    type: list

include_host_filters:
    description: A list of Jinja2 conditional expressions. Each expression in the list
      is evaluated for each host; when any of the expressions is evaluated to Truthy value,
      the host is included in the inventory. include_host_filters and filters options
      cannot be used together.
    type: list

delegation_token_file:
    description:
    - Path to delegation_token file. If not set then the value of the OCI_DELEGATION_TOKEN_FILE
      environment variable, if any, is used. Otherwise, defaults to config_file.
    - This parameter is only applicable when C(auth_type=instance_obo_user) is set.
    env:
    - name: OCI_DELEGATION_TOKEN_FILE
    type: str

api_user_key_pass_phrase:
    description: Passphrase used by the key referenced in api_user_key_file, if it is
      encrypted. Preference order is .oci.yml > OCI_USER_KEY_PASS_PHRASE environment variable
      > settings from config file This option is required if the passphrase is not specified
      through a configuration file (See config_file)
    env:
    - name: OCI_USER_KEY_PASS_PHRASE
    type: str

default_groups_preferences:
    description: OCI Inventory plugin creates some groups by default based on these properties
      ["availability_domain", "compartment_name", "region", "freeform_tags", "defined_tags"].
      If you don't want OCI inventory plugin to create these default groups, you can use
      this option to configure which of these default groups should be created. This option
      takes a dict of properties of inventory hosts based on which the groups will be
      created. You can also pass a list of jinja2 expressions under include and exclude
      if you want to include specific groups to be included/excluded based on these criteria
      if empty list is passed to this option, none of the default groups are created.
      default_groups and default_groups_preferences cannot be used together
    suboptions:
      availability_domain:
        description: Add groups based on the availability_domain
        suboptions:
          exclude:
            description: A list of jinja2 expressions. if this option is not used or empty,
              none of the availability_domain will be excluded. if any group is present
              in both include and exclude, then that group will be excluded.
            type: list
          include:
            description: A list of jinja2 expressions. if this option is not used or empty,
              all availability_domain will be included which are not in exclude list
            type: list
        type: dict
      compartment_name:
        description: Add groups based on the compartment_name
        suboptions:
          exclude:
            description: A list of jinja2 expressions. if this option is not used or empty,
              none of the compartment_name will be excluded. if any group is present in
              both include and exclude, then that group will be excluded.
            type: list
          include:
            description: A list of jinja2 expressions. if this option is not used or empty,
              all compartment_name will be included which are not in exclude list
            type: list
        type: dict
      defined_tags:
        description: Add groups based on the defined_tags
        suboptions:
          exclude:
            description: A list of jinja2 expressions. if this option is not used or empty,
              none of the defined_tags will be excluded. if any group is present in both
              include and exclude, then that group will be excluded.
            type: list
          include:
            description: A list of jinja2 expressions. if this option is not used or empty,
              all defined_tags will be included which are not in exclude list
            type: list
        type: dict
      freeform_tags:
        description: Add groups based on the freeform_tags
        suboptions:
          exclude:
            description: A list of jinja2 expressions. if this option is not used or empty,
              none of the freeform_tags will be excluded. if any group is present in both
              include and exclude, then that group will be excluded.
            type: list
          include:
            description: A list of jinja2 expressions. if this option is not used or empty,
              all freeform_tags will be included which are not in exclude list
            type: list
        type: dict
      region:
        description: Add groups based on the region
        suboptions:
          exclude:
            description: A list of jinja2 expressions. if this option is not used or empty,
              none of the regions will be excluded. if any group is present in both include
              and exclude, then that group will be excluded.
            type: list
          include:
            description: A list of jinja2 expressions. if this option is not used or empty,
              all regions will be included which are not in exclude list
            type: list
        type: dict
    type: dict

enable_parallel_processing:
    default: true
    description: Use multiple threads to speedup lookup. Default is set to True

hostname_format_preferences:
    description: A list of Jinja2 expressions in order of precedence to compose inventory_hostname.
      Ignores expression if result is an empty string or None value. hostname_format_preferences
      and hostname_format cannot be used together. The instance is ignored if none of
      the hostname_format_preferences resulted in a non-empty value
    type: list

instance_principal_authentication:
    description:
    - This parameter is DEPRECATED. Please use auth_type instead.
    - Use instance principal based authentication. If not set, the API key in your config
      will be used.