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 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 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 there a way for me to get all vars in one place instead of > redefining it multiple times? > > Thanks! > > > > -- > > 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] <javascript:> > <mailto:[email protected] <javascript:>>. > > To post to this group, send email to [email protected] > <javascript:> <mailto:[email protected] > <javascript:>>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/ansible-project/7f325296-b492-4615-a85a-075d384cd416%40googlegroups.com > > <https://groups.google.com/d/msgid/ansible-project/7f325296-b492-4615-a85a-075d384cd416%40googlegroups.com> > > > > <https://groups.google.com/d/msgid/ansible-project/7f325296-b492-4615-a85a-075d384cd416%40googlegroups.com?utm_medium=email&utm_source=footer > > <https://groups.google.com/d/msgid/ansible-project/7f325296-b492-4615-a85a-075d384cd416%40googlegroups.com?utm_medium=email&utm_source=footer>>. > > > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > -- > 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] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/735b0d5e-aa47-4840-9741-27d7cac9d0e1%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/735b0d5e-aa47-4840-9741-27d7cac9d0e1%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout. -- 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/f21833a8-07df-ca15-ec37-3454e8ef6a1a%40gmail.com. For more options, visit https://groups.google.com/d/optout.
