Hello,
I have a setup in google cloud which has been working very well with
Ansible. Till last week, we had only one "environment" per machine. Each
environment was marked by a network tag which ansible would pick up while
using limit. This worked beautifully.
Now, we are trying to consolidate some machines, ones that have our
database. Thus, we have 2 environments together e.g. tag_dev and tag_test
on one machine.
This has caused a bug where one of my play fails because ansible always
picks a particular tag.
$ cat inventory/group_vars/tag_dev
---
environment_tag: "tag_dev"
$ cat inventory/group_vars/tag_test
---
environment_tag: "tag_test"
$ cat db.yml
---
- hosts: "tag_db"
user: admin
roles:
- {role: db, tag: db}
$ cat roles/db/tasks/main.yml
---
- debug:
var: "environment_tag"
- name: Ensure nginx location is updated
template:
src: "nginx/location.conf.j2"
dest: "/etc/nginx/locations/monit-{{ ansible_hostname }}.conf"
delegate_to: "{{ hostvars[(groups['tag_web'] |
intersect(groups[environment_tag]))[0]]['internal_ip_address'] }}"
Now, when I run the playbook, I limit them by environment.
$ ansible-playbook -i inventory/gce.py db.yml --limit tag_dev
or
$ ansible-playbook -i inventory/gce.py db.yml --limit tag_test
earlier it would pick up environment_tag correctly, but not it picks
tag_test with either of the limit applied. Is there a way I can use the tag
from applied limit inside the play without having to pass an additional
parameter?
--
With Regards,
Mehul Ved
--
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/CADTL0oYuFDydzKbVY-fzv8V8G6O3gte3fPh4hOqExNhmn%3DXS8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.