diff options
author | AlanCoding <arominge@redhat.com> | 2020-04-23 03:39:02 +0200 |
---|---|---|
committer | AlanCoding <arominge@redhat.com> | 2020-04-23 03:41:52 +0200 |
commit | ab703e2a321aad071fc78349499859103e6f6ea6 (patch) | |
tree | 1e56ec44b1edb5cc88b9f9b5036b2c1bcc9ec89a /docs | |
parent | VMWare collection ready but waiting for release (diff) | |
download | awx-ab703e2a321aad071fc78349499859103e6f6ea6.tar.xz awx-ab703e2a321aad071fc78349499859103e6f6ea6.zip |
Add feature docs and document development tooling
Diffstat (limited to 'docs')
-rw-r--r-- | docs/inventory/inventory_plugins.md | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/docs/inventory/inventory_plugins.md b/docs/inventory/inventory_plugins.md index 00a763b361..01bf66fea6 100644 --- a/docs/inventory/inventory_plugins.md +++ b/docs/inventory/inventory_plugins.md @@ -1,8 +1,12 @@ # Transition to Ansible Inventory Plugins -Inventory updates have changed from using scripts, which are vendored as executable Python scripts, to using dynamically-generated YAML files which conform to the specifications of the `auto` inventory plugin. These are then parsed by their respective inventory plugin. +Inventory updates have changed from using deprecated inventory scripts, to using dynamically-generated YAML files which are parsed by their respective inventory plugin. -The major organizational change is that the inventory plugins are part of the Ansible core distribution, whereas the same logic used to be a part of AWX source. +In Ansible 2.8, the inventory plugins which are part of the Ansible core distribution were used. +This only applied to a few select sources. + +In all other circumstances, inventory imports make use of the inventory plugin from vendored collections. +Those collections are downloaded from Ansible Galaxy at the time of packaging building the container image. ## Prior Background for Transition @@ -14,11 +18,10 @@ AWX used to maintain logic that parsed `.ini` inventory file contents, in additi The CLI entry point `ansible-inventory` was introduced in Ansible 2.4. In Tower 3.2, inventory imports began running this command as an intermediary between the inventory and the import's logic to save content to the database. Using `ansible-inventory` eliminates the need to maintain source-specific logic, relying on Ansible's code instead. This also enables consistent data structure output from `ansible-inventory`. There are many valid structures that a script can provide, but the output from `ansible-inventory` will always be the same, thus the AWX logic to parse the content is simplified. This is why even scripts must be ran through the `ansible-inventory` CLI. -Along with this switchover, a backported version of `ansible-inventory` was provided, which supports Ansible versions 2.2 and 2.3. - ### Removal of Backport +Along with the `ansible-inventory` switchover, a backported version of `ansible-inventory` was provided, which supported Ansible versions 2.2 and 2.3. In AWX 3.0.0 (and Tower 3.5), the backport of `ansible-inventory` was removed, and support for using custom virtual environments was added. This set the minimum version of Ansible necessary to run _any_ inventory update to 2.4. @@ -30,9 +33,21 @@ In AWX 4.0.0 (and Tower 3.5) inventory source types start to switch over to plug To see in which version the plugin transition will happen, see `awx/main/models/inventory.py` and look for the source name as a subclass of `PluginFileInjector`, and there should be an `initial_version`, which is the first version that was deemed (via testing) to have sufficient parity in the content for its inventory plugin returns. For example, `openstack` will begin using the inventory plugin in Ansible version 2.8. If you run an OpenStack inventory update with Ansible 2.7.x or lower, it will use the script. -The eventual goal is for all source types to have moved to plugins. For any given source, after the `initial_version` for plugin use is higher than the lowest supported Ansible version, the script can be removed and the logic for script credential injection will also be removed. +At some point, scripts will be removed and the script-related (for credentials and configuration) logic will also be removed. + + +### Management of Collections + +Collections are used for inventory imports starting in Ansible 2.9, and each collection has its own versioning independently from Ansible. +Versions for those collections are set in the requirements file `requirements/collections_requirements.yml`. -For example, after AWX no longer supports Ansible 2.7, the script `awx/plugins/openstack_inventory.py` will be removed. +The location of vendored collections is set by the file-only setting `INVENTORY_COLLECTIONS_ROOT`. +For development purposes, this can be changed so that you can test against development versions of those collections. +Instructions for doing this are in `tools/collections`. + +If, for some reason, you need to change the version of a particular collection used in inventory imports, +you can use the `ansible-galaxy` tool to update the collection inside of the `INVENTORY_COLLECTIONS_ROOT`. +Note that the logic for building the inventory file is written and tested only for the version pinned in the requirements file. ## Changes to Expect in Imports @@ -54,11 +69,6 @@ More `hostvars` will appear if the inventory plugins are used. To maintain backw A small number of `hostvars` will be lost because of general deprecation needs. -#### Host Names - -In many cases, the host names will change. In all cases, accurate host tracking will still be maintained via the host `instance_id`. - - ## Writing Your Own Inventory File If you do not want any of this compatibility-related functionality, then you can add an SCM inventory source that points to your own file. You can also apply a credential of a `managed_by_tower` type to that inventory source that matches the credential you are using, as long as it is not `gce` or `openstack`. |