Re: [ansible-project] Accessing variables in yaml file

2018-11-30 Thread Brian Coca
group_vars can be playbook adjacent, they do not require an inventory (though they normally work better with one). You can also use `-e @varsfile.yml ` on the command line to add extra vars Another option is to define them in a vars/myvars.yml and use vars_files: in each play to include them, ins

Re: [ansible-project] Accessing variables in yaml file

2018-11-29 Thread Uwe Sauter
If you really cannot afford an inventory file and a group_vars file then have a look at https://stackoverflow.com/a/47811099 Am 30.11.18 um 00:00 schrieb Andy: > Is there a way to do it in the same playbook where I define my tasks? I do > not have an inventory file. > > On Thursday, November 2

Re: [ansible-project] Accessing variables in yaml file

2018-11-29 Thread Tony Chia
If the variables you want to share between plays is static it’s more straight forward to use and group_vars file. The group_vars file doesn’t have to be inside the inventory folder. It can be in a group_vars folder on the same level as your playbook -- You received this message because you a

Re: [ansible-project] Accessing variables in yaml file

2018-11-29 Thread Andy
Is there a way to do it in the same playbook where I define my tasks? I do not have an inventory file. On Thursday, November 29, 2018 at 2:40:58 PM UTC-8, Uwe Sauter wrote: > > Look for group vars and put all servers in the same group in the inventory > file. > > Am 29.11.18 um 23:11 schrieb An

Re: [ansible-project] Accessing variables in yaml file

2018-11-29 Thread Uwe Sauter
Look for group vars and put all servers in the same group in the inventory file. Am 29.11.18 um 23:11 schrieb Andy: I am new to ansible. I create a yaml file with multiple hosts defined --- -hosts: localhost   vars:   tasks: -hosts: webserver1  vars: same as localhost  tasks: ...

[ansible-project] Accessing variables in yaml file

2018-11-29 Thread Andy
I am new to ansible. I create a yaml file with multiple hosts defined --- -hosts: localhost vars: tasks: -hosts: webserver1 vars: same as localhost tasks: -hosts: webserver2 vars: same as localhost tasks: ... - hosts: localhost vars: same as localhost tasks: Is