Hey Nicholas,

there are many possible locations where you could define it. Are you aware 
that there is a difference between "roles" and "playbooks"? The filelayout 
you created is a role- layout. A role contains a set of tasks which are 
applied to a host. The decision which host the role is running on is 
already made. So every variable you define in inside the role is available 
to that host.

So, you could define the variable inside the defaults/main.yml (least 
precedence), in the vars/main.yml or directly in the task.

Here is a complete list:


   - role defaults [1] 
   <http://docs.ansible.com/ansible/latest/playbooks_variables.html#id10>
   - inventory INI or script group vars [2] 
   <http://docs.ansible.com/ansible/latest/playbooks_variables.html#id11>
   - inventory group_vars/all
   - playbook group_vars/all
   - inventory group_vars/*
   - playbook group_vars/*
   - inventory INI or script host vars [2] 
   <http://docs.ansible.com/ansible/latest/playbooks_variables.html#id11>
   - inventory host_vars/*
   - playbook host_vars/*
   - host facts
   - play vars
   - play vars_prompt
   - play vars_files
   - role vars (defined in role/vars/main.yml)
   - block vars (only for tasks in block)
   - task vars (only for the task)
   - role (and include_role) params
   - include params
   - include_vars
   - set_facts / registered vars
   - extra vars (always win precedence)


Check out this doc: 
http://docs.ansible.com/ansible/latest/playbooks_variables.html



Am Freitag, 28. Juli 2017 20:41:37 UTC+2 schrieb Nicholas Sheridan:
>
> Hi Forum, 
>
>
> If I write playbooks using the "ansible-galaxy init" command:
>
> ansible-galaxy init standardisationBot
>
> Which gives me this
>
> shr1mac1:standardisationBot nsheridan$ tree 
>
> .
>
> ├── README.md
>
> ├── defaults
>
> │   └── main.yml
>
> ├── handlers
>
> │   └── main.yml
>
> ├── meta
>
> │   └── main.yml
>
> ├── tasks
>
> │   └── main.yml
>
> ├── tests
>
> │   ├── inventory
>
> │   └── test.yml
>
> └── vars
>
>     └── main.yml
>
>
> 6 directories, 8 files
>
> shr1mac1:standardisationBot nsheridan$
>
> How do I associate a variable with host R1?  more's the point where do I 
> put anything???? Can anyone help?
>
> Thanks nik
>

-- 
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/2f21e663-eb8c-4cd5-9858-f8678ddcfcd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to