AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.06k
stars
3.42k
forks
source link
Possible to move a host from one inventory to another #3784
Using the API, a client can move a host from one inventory to another.
This leaves in place links to groups and inventory sources, pointing to the old inventory. This leaves the server in a very degenerate state.
ENVIRONMENT
AWX version: 4.0.0
AWX install method: openshift, minishift, docker on linux, docker for mac, boot2docker
Ansible version: X.Y.Z
Operating System:
Web Browser:
STEPS TO REPRODUCE
Create 2 inventories.
Inside the first inventory, create a host and a group, make the host a child of the group.
Get the pk of the host and the pk of the second inventory
POST
/api/v2/inventories/<pk of second inventory>/hosts/
{"id": <pk of host in first inventory>}
EXPECTED RESULTS
400 you should not be able to do this action
You cannot perform this action as a PUT or PATCH on /api/v2/hosts/<pk of host in first inventory>
ACTUAL RESULTS
204 response code and host is now moved to 2nd inventory
ADDITIONAL INFORMATION
Even though the host is in the 2nd inventory, it remains a child of the group in the 1st inventory. What will the inventory given to ansible-playbook look like? 🤷♂
ISSUE TYPE
SUMMARY
Using the API, a client can move a host from one inventory to another.
This leaves in place links to groups and inventory sources, pointing to the old inventory. This leaves the server in a very degenerate state.
ENVIRONMENT
STEPS TO REPRODUCE
Create 2 inventories.
Inside the first inventory, create a host and a group, make the host a child of the group.
Get the pk of the host and the pk of the second inventory
EXPECTED RESULTS
400 you should not be able to do this action
You cannot perform this action as a PUT or PATCH on
/api/v2/hosts/<pk of host in first inventory>
ACTUAL RESULTS
204 response code and host is now moved to 2nd inventory
ADDITIONAL INFORMATION
Even though the host is in the 2nd inventory, it remains a child of the group in the 1st inventory. What will the inventory given to
ansible-playbook
look like? 🤷♂