How to enable or disable a host during import
How to enable or disable a host during import
We want to able to control the available of a managed host that is imported from dynamic inventory script. Default behavior only allow disabling manually created host. Host imported with dynamic inventory is always enabled.
To change this behavior:
- Create a .py file under /etc/tower/conf.d For example, hostvar-enabler.py
- Insert into the file the following: SCM_ENABLED_VAR = ‘isenabled’ SCM_ENABLED_VALUE = ‘true’
- Restart Tower host
Now whenever a host is imported with variable ‘isenabled’: ‘true’ or without ‘isenabled’, it will be imported as enabled. Anythingelse is set on variable ‘isenabled’, the host will be imported as disabled. The variable name and value is arbitrary.
Leave a comment