(cherry picked from commit58ca82fa1c
) (cherry picked from commitfe119c18ef
)
This commit is contained in:
parent
1d06a86481
commit
0a7d5ebd73
1 changed files with 5 additions and 7 deletions
|
@ -870,7 +870,7 @@ Basically, anything that goes into "role defaults" (the defaults folder inside t
|
|||
This variable, ``ansible_group_priority``, can only be set in the inventory source and not in group_vars/ as the variable is used in the loading of group_vars/.
|
||||
|
||||
|
||||
Another important thing to consider (for all versions) is that connection variables override config, command line and play/role/task specific options and keywords. For example, if your inventory specifies `ansible_ssh_user: ramon` and you run::
|
||||
Another important thing to consider (for all versions) is that connection variables override config, command line and play/role/task specific options and keywords. For example, if your inventory specifies ``ansible_ssh_user: ramon`` and you run::
|
||||
|
||||
ansible -u lola myhost
|
||||
|
||||
|
@ -880,10 +880,10 @@ For plays/tasks this is also true for ``remote_user``. Assuming the same invento
|
|||
|
||||
- hosts: myhost
|
||||
tasks:
|
||||
- command: i'll connect as ramon still
|
||||
- command: I'll connect as ramon still
|
||||
remote_user: lola
|
||||
|
||||
will have the value of `remote_user` overwritten by `ansible_ssh_user` in the inventory.
|
||||
will have the value of ``remote_user`` overwritten by ``ansible_ssh_user`` in the inventory.
|
||||
|
||||
This is done so host-specific settings can override the general settings. These variables are normally defined per host or group in inventory,
|
||||
but they behave like other variables.
|
||||
|
@ -892,7 +892,7 @@ If you want to override the remote user globally (even over inventory) you can u
|
|||
|
||||
ansible... -e "ansible_user=maria" -u lola
|
||||
|
||||
the `lola` value is still ignored, but `ansible_user=maria` takes precedence over all other places where `ansible_user` (or `ansible_ssh_user`, or `remote_user`) might be set.
|
||||
the ``lola`` value is still ignored, but ``ansible_user=maria`` takes precedence over all other places where ``ansible_user`` (or ``ansible_ssh_user``, or ``remote_user``) might be set.
|
||||
|
||||
You can also override as a normal variable in a play::
|
||||
|
||||
|
@ -900,7 +900,7 @@ You can also override as a normal variable in a play::
|
|||
vars:
|
||||
ansible_user: lola
|
||||
tasks:
|
||||
- command: i'll connect as lola!
|
||||
- command: I'll connect as lola!
|
||||
|
||||
.. _variable_scopes:
|
||||
|
||||
|
@ -1056,5 +1056,3 @@ For information about advanced YAML syntax used to declare variables and have mo
|
|||
Have a question? Stop by the google group!
|
||||
`irc.freenode.net <http://irc.freenode.net>`_
|
||||
#ansible IRC chat channel
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue