Are you sure that it actually works? It didn't when I tested it (looks
like order matters).
On Thursday, April 6, 2017 at 1:22:43 PM UTC-4, Kai Stian Olstad wrote:
>
> On 06. april 2017 18:57, Anthony Cheng wrote:
> > Is it possible to set variable before hosts in playbook?
> >
> > Something like this doesn't work:
> >
> > var:
> > VARHOSTNAME: test
> >
> > - hosts: "{{ VARHOSTNAME }}"
> > gather_facts: true
> > become: yes
> >
> > I know I can set variable in vars file or pass in environment values at
> > command line but wanted to know if i can just define variable directly
> at
> > the playbook level.
>
> You can have vars as part of the play
>
> - hosts: "{{ VARHOSTNAME }}"
> gather_facts: true
> become: yes
> vars:
> VARHOSTNAME: test
>
> --
> Kai Stian Olstad
>
--
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/80a6f06d-8fb3-4349-b7e7-df9d5f279c47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.