简体   繁体   中英

How to enable or disable multiple hosts in Ansible Tower/AWX to include or exclude while running jobs?

Is there any way to enable or disable multiple hosts in an inventory to include or exclude them while running jobs?

I know we can disable one host at a time via the Inventories web UI, but this is very time consuming.

库存截图

I was looking for something like grouping the hosts and disabling all the hosts in a group with a single click.

Is it possible?

How to limit hosts in Ansible Tower while running Job Templates?

During configuration of your Job Template you can choose to select PROMPT ON LAUNCH for LIMIT .

This will exactly provide the functionality you're asking for.

Limit: A host pattern to further constrain the list of hosts managed or affected by the playbook. Multiple patterns can be separated by colons ( : ). As with core Ansible, a:b means “in group a or b”, a:b:&c means “in a or b but must be in c”, and a:!b means “in a, and definitely not in b”.

Prompt on Launch: If selected, even if a default value is supplied, you will be prompted upon launch to choose a limit.

By Launching a Job Template you can then include or exclude the host group in a Survey .

To summarize in other words, you are not enabling or disabling host groups in your current inventory (annot.: as such "global" operation would affect other jobs too), instead you are applying Job Templates to existing hosts or groups from your inventory. During this you can apply an include or exclude pattern.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM