# disable host in source based inventory

**URL:** <https://forum.ansible.com/t/disable-host-in-source-based-inventory/25654>\
**Category:** AWX Project\
**Created:** [October 2, 2017, 2:55am UTC](https://forum.ansible.com/t/disable-host-in-source-based-inventory/25654 "2017-10-02T02:55:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hudec\_Peter](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@Hudec\_Peter](https://forum.ansible.com/u/Hudec_Peter)\
**Post date:** [October 2, 2017, 2:55am UTC](https://forum.ansible.com/t/disable-host-in-source-based-inventory/25654/1 "2017-10-02T02:55:41Z")

</div>

Hi,

is there any way how to just disable host on source based inventory.  
Adding some variable or any other trick.

The balloon help says, that the flag is set by SYNC process.

&nbsp;&nbsp;Peter

---

<div class="post-metadata">

**Author:** ![AlanCoding](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alancoding/32/301_2.png) [@AlanCoding](https://forum.ansible.com/u/AlanCoding)\
**Post date:** [October 2, 2017, 11:57am UTC](https://forum.ansible.com/t/disable-host-in-source-based-inventory/25654/2 "2017-10-02T11:57:16Z")

</div>

Yes, this should be possible. Look inside of awx/settings/defaults.py, and you will see a list of variables for each kind of inventory import. Look at SCM\_ENABLED\_VALUE and CUSTOM\_ENABLED\_VALUE. You’ll need to set those (or just one, depending on the type of import you need to work) to the key (inside of hostvars for every host) that will signal whether the host should be put into the disabled state.

Alan

---

<div class="post-metadata">

**Author:** ![Hudec\_Peter](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@Hudec\_Peter](https://forum.ansible.com/u/Hudec_Peter)\
**Post date:** [October 3, 2017, 1:48am UTC](https://forum.ansible.com/t/disable-host-in-source-based-inventory/25654/3 "2017-10-03T01:48:10Z")

</div>

Hi Alan,

thanks, I checked the code and it should work.

But how can I change this setting inside the container? I need to change  
the source and rebuild it ?

I tried to set environment variable for the inventory scm, but it do not  
work and I haven't found support for this in the source code also.

I'm going to rebuild the images.

&nbsp;&nbsp;Peter

---

<div class="post-metadata">

**Author:** ![Hudec\_Peter](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@Hudec\_Peter](https://forum.ansible.com/u/Hudec_Peter)\
**Post date:** [October 3, 2017, 3:19am UTC](https://forum.ansible.com/t/disable-host-in-source-based-inventory/25654/4 "2017-10-03T03:19:35Z")

</div>

I set  
SCM\_ENABLED\_VAR = 'host.enabled'  
and rebuild the dockerimages.

According the code, if the SCM\_ENABLED\_VALUEis not set, the boolean  
valies shouldbe accpeted. I tested the code from the  
awx/main/management/commands/inventory\_import.py

The host variable is set to

host:  
&nbsp;&nbsp;enabled: false

but it is still ONLINE ;(

---

<div class="post-metadata">

**Author:** ![Hudec\_Peter](https://avatars.discourse-cdn.com/v4/letter/h/a87d85/32.png) [@Hudec\_Peter](https://forum.ansible.com/u/Hudec_Peter)\
**Post date:** [October 3, 2017, 8:17am UTC](https://forum.ansible.com/t/disable-host-in-source-based-inventory/25654/5 "2017-10-03T08:17:26Z")

</div>

Hi,

it a little bit tricky to change the settings.py, but it works.

I created feature request to read variables from the ENV  
[https://github.com/ansible/awx/issues/350](https://github.com/ansible/awx/issues/350)

&nbsp;&nbsp;thanks  
&nbsp;&nbsp;&nbsp;&nbsp;Peter
