disable host in source based inventory

369 views
Skip to first unread message

Peter Hudec

unread,
Oct 1, 2017, 10:55:43 PM10/1/17
to awx-p...@googlegroups.com
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

--
*Peter Hudec*
Infraštruktúrny architekt
phu...@cnc.sk <mailto:phu...@cnc.sk>

*CNC, a.s.*
Borská 6, 841 04 Bratislava
Recepcia: +421 2  35 000 100

Mobil:+421 905 997 203
*www.cnc.sk* <http:///www.cnc.sk>

Alan Rominger

unread,
Oct 2, 2017, 7:57:17 AM10/2/17
to phu...@cnc.sk, AWX Project
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

--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project+unsubscribe@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/6fa5f83f-c1c9-49b5-14be-0ed6ddd5c57d%40cnc.sk.
For more options, visit https://groups.google.com/d/optout.

Peter Hudec

unread,
Oct 2, 2017, 9:48:11 PM10/2/17
to awx-p...@googlegroups.com
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

On 02/10/2017 13:57, Alan Rominger wrote:
> 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
>
> On Sun, Oct 1, 2017 at 10:55 PM, Peter Hudec <phu...@cnc.sk
> <mailto:phu...@cnc.sk>> wrote:
>
> 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
>
> --
> *Peter Hudec*
> Infraštruktúrny architekt
> phu...@cnc.sk <mailto:phu...@cnc.sk> <mailto:phu...@cnc.sk
> <mailto:phu...@cnc.sk>>
>
> *CNC, a.s.*
> Borská 6, 841 04 Bratislava
> Recepcia: +421 2  35 000 100 <tel:%2B421%202%C2%A0%2035%20000%20100>
>
> Mobil:+421 905 997 203 <tel:%2B421%C2%A0905%20997%20203>
> *www.cnc.sk <http://www.cnc.sk>* <http:///www.cnc.sk
> <http://www.cnc.sk>>
>
> --
> You received this message because you are subscribed to the Google
> Groups "AWX Project" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to awx-project...@googlegroups.com
> <mailto:awx-project%2Bunsu...@googlegroups.com>.
> To post to this group, send email to awx-p...@googlegroups.com
> <mailto:awx-p...@googlegroups.com>.
> <https://groups.google.com/d/msgid/awx-project/6fa5f83f-c1c9-49b5-14be-0ed6ddd5c57d%40cnc.sk>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "AWX Project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to awx-project...@googlegroups.com
> <mailto:awx-project...@googlegroups.com>.
> To post to this group, send email to awx-p...@googlegroups.com
> <mailto:awx-p...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/awx-project/CAADLLLjO6hCXLLxpjx%2Ba4L9MWNKnSjpXQE%3DQxNB3LPR3wWGHGw%40mail.gmail.com
> <https://groups.google.com/d/msgid/awx-project/CAADLLLjO6hCXLLxpjx%2Ba4L9MWNKnSjpXQE%3DQxNB3LPR3wWGHGw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


Peter Hudec

unread,
Oct 2, 2017, 11:19:37 PM10/2/17
to awx-p...@googlegroups.com
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 ;(

Peter Hudec

unread,
Oct 3, 2017, 4:17:28 AM10/3/17
to awx-p...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages