Hi,
I want to be able to execute tasks on a subgroup of servers. It can be done
via groups ([dbservers_cannary]) in the inventory file, but after checking
out group_by funcionality, I thought of just adding a variable to the host
in order to identify its pertenence to the subgroup.
This is for the cannary release before full deploy.
The code below doesn't work as originally intented. Any idea what I am
missing?
Regards,
Osvaldo
$ cat inventory
[dbservers]
db1 ansible_connection=local deploy=release
db2 ansible_connection=local deploy=cannary
db3 ansible_connection=local deploy=release
[wwwservers]
web1 ansible_connection=local deploy=cannary
web2 ansible_connection=local deploy=release
web3 ansible_connection=local deploy=release
$ cat vars.yml
---
- hosts: all
gather_facts: false
tasks:
- group_by: key=deploy
- name: ping cannary servers
hosts: cannary
gather_facts: false
tasks:
- name: ping
action: ping
$ ansible-playbook -i inventory vars.yml
PLAY [all]
********************************************************************
TASK: [group_by key=deploy]
***************************************************
changed: [web1]
PLAY [ping cannary servers]
***************************************************
skipping: no hosts matched
PLAY RECAP
********************************************************************
db1 : ok=1 changed=1 unreachable=0 failed=0
...
$
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAJZu1hVD8SYHQbi2sc%2B0eT4k2GBATMTn6U%3DmPhfVOs3WuQmZ3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.