-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
Please confirm the following
- I agree to follow this project's code of conduct.
- I have checked the current issues for duplicates.
- I understand that AWX is open source software provided for free and that I might not receive a timely response.
Feature type
New Feature
Feature Summary
When using the module to add additional variables to an existing Inventory Host, the existing variables are overwritten an not appended to. Maybe it needs an update state to append/update existing hosts if this is the correct behavior.
Select the relevant components
- UI
- API
- Docs
- Collection
- CLI
- Other
Steps to reproduce
This example playbook will demonstrate the issue
-
name: Add host to AWX Inventory
hosts: localhost
vars:
inventory_name:
host_name:
host_description:
inv_username: "awx_username"
inv_password: "awx_password"
ansible_url: "https://ansible.home.local/"
vm_name: "Alma9"
tasks:-
name: "Create host {{vm_name}}"
awx.awx.host:
name: "{{vm_name}}"
inventory: "linux_build"
state: present
controller_host: "{{ ansible_url }}"
controller_username: "{{ inv_username }}"
controller_password: "{{ inv_password }}"
validate_certs: no
variables:
os_type: "linux" -
name: "update vars for{{vm_name}}"
awx.awx.host:
name: "{{vm_name}}"
inventory: "linux_build"
state: present
controller_host: "{{ ansible_url }}"
controller_username: "{{ inv_username }}"
controller_password: "{{ inv_password }}"
validate_certs: no
variables:
os_ver: "9.6"
-
Current results
The last play in the playbook overwrites the exiting variables and leaves the following
{
"os_ver": "9.6"
}
Sugested feature result
the host should have 2 variables
{
"os_type": "linux"
"os_ver": "9.6"
}
Additional information
The module says it should "Create, update, or destroy Automation Platform Controller hosts". Does update mean to only overwrite existing variables and not update/append them? Maybe add an update state to append data to existing host variables.