Hi all,
This is another issue I'm running with the migration from Chef to Ansible.
In Chef you can use chef search in your code logic to do various things. We
need to set a tag inside a config file for every role we run on the server
the same way as Chef because our monitoring system aggregation metrics
depends on these tags for reporting and alerting.
At the moment we have defined a variable named "role" under each role vars
and if we deploy many roles in one server we have to populate the
configuration file with all tags.
For example we have
roles :
common
web
db
application
In common we deploy the template :
- name: deploy /etc/monitoring.conf
template: src=monitoring.conf.j2 dest=/etc/monitoring.conf
# monitoring.conf.j2
tags: env:{{ env }}, role:{{ role }}
We need the end result file to be something like :
tags: env: prod, role: common, role:web, role:db, role:application
1) Is there a way Ansible knows which role is running or I have to manually
define a var for every role as I have in my example above ?
2) Most important how can I have all role tags in the configuration file
and not only a singleton ? Can this be done in an idempotent way ?
Thanks in advance,
Nicolas.
--
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/18305aa8-e2a4-4a83-b07f-c2b64552fa41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.