Hi All,
I have a playbook which copy application.proprties with db.username and
db.password.
I have qa env and qa1 is a cluster with app and ui server. The hosts file (
hosts.qa) is as per the best practises mentioned in docs.ansible.com site.
I have similar hosts file for dev ( hosts.dev )
I have group_vars file for qa and qa1 with db.usernamd and db.password
values. Same for dev and dev1 groups
>ansible-playbook -i inventory/hosts.qa --limit qa1 site.yml
When I run the playbook, with --limit qa1, the application properties
template is not updated with qa1 group_vars file values, instead it has
"qa" as db_username and db_password. The same works fine for --limit dev1
Has anyone faced this problem ?
Thanks,
Olga
ansible 1.7.2
Centos 6.5
*site.yml*
---
- hosts: appservers
remote_user: '{{ remote_user }}'
sudo: True
tasks:
- name: configure application properties
template: src=templates/application.properties.j2
dest=/tmp/application.properties
owner=root group=root mode=744
*templates/application.properties*
# {{ ansible_managed }}
#Database Configuration
db.username={{ db_username }}
db.password={{ db_password }}
*inventory/hosts.dev*
[dev1-appserver]
xyz.com
[dev1-uiserver]
abc.com
[appservers:children]
dev1-appserver
[dev1:children]
dev1-appserver
dev1-uiserver
[dev:children]
dev1-appserver
dev1-uiserver
[uiservers:children]
dev1-uiserver
*inventory/hosts.qa <http://hosts.qa>*
[qa1-uiserver]
123.com
[qa1-appserver]
567.com
[qa:children]
qa1-appserver
qa1-uiserver
[appservers:children]
qa1-appserver
[qa1:children]
qa1-appserver
qa1-uiserver
[uiservers:children]
qa1-uiserver
*group_vars/qa*
# variables related to the qa environment
db_username: qa
db_password: qa
*group_vars/qa1*
# variables related to the qa environment
db_username: qa1
db_password: qa1
*group_vars/dev*
# variables related to the dev environment
db_username: dev
db_password: dev
*group_vars/dev1*
# variables related to the dev1 environment
db_username: dev1
db_password: dev1
--
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/CAKQjojSfDDBN-F4kj7__qOYZwv8LpQM7PVBD6ytxbEjAkNLwKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.