disable host in source based inventory

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.

  Peter

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

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.

  Peter

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:
  enabled: false

but it is still ONLINE ;(

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

  thanks
    Peter