Hi!
I have multiple projects and try to use ansible for all of them.
One of idea was to make my playbooks more flexible by specified variable files for each project. In this case i have one role - deploy software and multiple playbooks with config like this
But when i try to use some variables from dbvars file for hosts in db group - ansible say that cant find this variable. If i specified in this host group project_name - all work fine… It make me little confused, because i specified this variable for all hosts on top…
Try to insert nice code from playbook and fail
Here is current link
https://gist.github.com/anonymous/35117b7088079fba8af4
I might be missing something but using group_vars solves this problem
cleanly for me.
group_vars/all are 'globals'
group_vars/webservers are available to all webservers
and so on.
Thanks for your reply!
I have multiple projects and each of them have webservers, bases or other groups. With your solution i need to use various names for this groups - test_app, prod1_app, prod2_app and others… It will be real hard to manage all this group names
My point is - why variable from “all” section in playbook doesnt work in lower part of same playbook - for app or db hosts. And how to deal with it
Do you need to use defaults/main.yml for sane defaults inside your role ?
R.
Сб. 10 мая 2014 00:14:34, Rénald Casagraude писал:
Do you need to use defaults/main.yml for sane defaults inside your role ?
R.
This file keep variables for role. I need variable for all host groups in playbook. I think, best way is use -e key, or write this variable in inventory file.. Hmm, try this solution tommorow...