mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 00:22:10 +02:00
fix become yes/no to true/false (#80515)
This commit is contained in:
@@ -551,7 +551,7 @@ The following example walks through the integration tests for the ``vyos.vyos.vy
|
||||
file: "{{ test_case_to_run }}"
|
||||
vars:
|
||||
ansible_connection: local
|
||||
ansible_become: no
|
||||
ansible_become: false
|
||||
with_first_found: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
||||
|
||||
@@ -56,13 +56,13 @@ Several network platforms support privilege escalation, where certain tasks must
|
||||
Using ``become`` for privilege escalation
|
||||
-----------------------------------------
|
||||
|
||||
Use the top-level Ansible parameter ``become: yes`` with ``become_method: enable`` to run a task, play, or playbook with escalated privileges on any network platform that supports privilege escalation. You must use either ``connection: network_cli`` or ``connection: httpapi`` with ``become: yes`` with ``become_method: enable``. If you are using ``network_cli`` to connect Ansible to your network devices, a ``group_vars`` file would look like:
|
||||
Use the top-level Ansible parameter ``become: true`` with ``become_method: enable`` to run a task, play, or playbook with escalated privileges on any network platform that supports privilege escalation. You must use either ``connection: network_cli`` or ``connection: httpapi`` with ``become: true`` with ``become_method: enable``. If you are using ``network_cli`` to connect Ansible to your network devices, a ``group_vars`` file would look like:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
ansible_connection: ansible.netcommon.network_cli
|
||||
ansible_network_os: cisco.ios.ios
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
|
||||
For more information, see :ref:`Become and Networks<become_network>`
|
||||
|
||||
@@ -634,7 +634,7 @@ For example:
|
||||
|
||||
Suggestions to resolve:
|
||||
|
||||
Use ``connection: ansible.netcommon.network_cli`` and ``become: yes``
|
||||
Use ``connection: ansible.netcommon.network_cli`` and ``become: true``
|
||||
|
||||
|
||||
Proxy Issues
|
||||
|
||||
@@ -28,7 +28,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes``
|
||||
|enable_mode| supported: use ``ansible_become: true``
|
||||
with ``ansible_become_method: enable``
|
||||
and ``ansible_become_password:``
|
||||
|
||||
@@ -51,7 +51,7 @@ Example CLI ``group_vars/cnos.yml``
|
||||
ansible_network_os: community.network.cnos
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -28,7 +28,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes``
|
||||
|enable_mode| supported: use ``ansible_become: true``
|
||||
with ``ansible_become_method: enable``
|
||||
and ``ansible_become_password:``
|
||||
|
||||
@@ -52,7 +52,7 @@ Example CLI ``group_vars/dellos10.yml``
|
||||
ansible_network_os: dellemc.os10.os10
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -28,7 +28,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes``
|
||||
|enable_mode| supported: use ``ansible_become: true``
|
||||
with ``ansible_become_method: enable``
|
||||
and ``ansible_become_password:``
|
||||
|
||||
@@ -51,7 +51,7 @@ Example CLI ``group_vars/dellos6.yml``
|
||||
ansible_network_os: dellemc.os6.os6
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -28,7 +28,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes``
|
||||
|enable_mode| supported: use ``ansible_become: true``
|
||||
with ``ansible_become_method: enable``
|
||||
and ``ansible_become_password:``
|
||||
|
||||
@@ -51,7 +51,7 @@ Example CLI ``group_vars/dellos9.yml``
|
||||
ansible_network_os: dellemc.os9.os9
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -28,7 +28,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes``
|
||||
|enable_mode| supported: use ``ansible_become: true``
|
||||
with ``ansible_become_method: enable``
|
||||
and ``ansible_become_password:``
|
||||
|
||||
@@ -53,7 +53,7 @@ Example CLI ``group_vars/enos.yml``
|
||||
ansible_network_os: community.network.enos
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -32,8 +32,8 @@ Connections available
|
||||
|
||||
|enable_mode| supported: |br| supported: |br|
|
||||
|
||||
* use ``ansible_become: yes`` * ``httpapi``
|
||||
with ``ansible_become_method: enable`` uses ``ansible_become: yes``
|
||||
* use ``ansible_become: true`` * ``httpapi``
|
||||
with ``ansible_become_method: enable`` uses ``ansible_become: true``
|
||||
with ``ansible_become_method: enable``
|
||||
|
||||
Returned Data Format ``stdout[0].`` ``stdout[0].messages[0].``
|
||||
@@ -56,7 +56,7 @@ Example CLI ``group_vars/eos.yml``
|
||||
ansible_network_os: arista.eos.eos
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
@@ -110,7 +110,7 @@ Example eAPI ``group_vars/eos.yml``
|
||||
ansible_network_os: arista.eos.eos
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
proxy_env:
|
||||
http_proxy: http://proxy.example.com:8080
|
||||
|
||||
@@ -28,7 +28,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes`` with
|
||||
|enable_mode| supported: use ``ansible_become: true`` with
|
||||
``ansible_become_method: enable`` and ``ansible_become_password:``
|
||||
|
||||
Returned Data Format ``stdout[0].``
|
||||
@@ -49,7 +49,7 @@ Example CLI ``group_vars/icx.yml``
|
||||
ansible_network_os: community.network.icx
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -28,7 +28,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes`` with
|
||||
|enable_mode| supported: use ``ansible_become: true`` with
|
||||
``ansible_become_method: enable`` and ``ansible_become_password:``
|
||||
|
||||
Returned Data Format ``stdout[0].``
|
||||
@@ -51,7 +51,7 @@ Example CLI ``group_vars/ios.yml``
|
||||
ansible_network_os: cisco.ios.ios
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -28,7 +28,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes``
|
||||
|enable_mode| supported: use ``ansible_become: true``
|
||||
with ``ansible_become_method: enable``
|
||||
and ``ansible_become_password:``
|
||||
|
||||
@@ -52,7 +52,7 @@ Example CLI ``group_vars/mlx.yml``
|
||||
ansible_network_os: community.network.ironware
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -29,7 +29,7 @@ Connections available
|
||||
Connection Settings ``ansible_connection:`` ``ansible_connection:``
|
||||
``ansible.netcommon.network_cli`` ``ansible.netcommon.httpapi``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes`` not supported by NX-API
|
||||
|enable_mode| supported: use ``ansible_become: true`` not supported by NX-API
|
||||
with ``ansible_become_method: enable``
|
||||
and ``ansible_become_password:``
|
||||
|
||||
@@ -53,7 +53,7 @@ Example CLI ``group_vars/nxos.yml``
|
||||
ansible_network_os: cisco.nxos.nxos
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -51,7 +51,7 @@ Example CLI ``group_vars/routeros.yml``
|
||||
ansible_network_os: community.network.routeros
|
||||
ansible_user: myuser
|
||||
ansible_password: !vault...
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_become_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -29,7 +29,7 @@ Connections available
|
||||
|
||||
Connection Settings ``ansible_connection: ansible.netcommon.network_cli``
|
||||
|
||||
|enable_mode| supported: use ``ansible_become: yes``
|
||||
|enable_mode| supported: use ``ansible_become: true``
|
||||
with ``ansible_become_method: enable``
|
||||
|
||||
Returned Data Format ``stdout[0].``
|
||||
@@ -51,7 +51,7 @@ Example CLI ``group_vars/voss.yml``
|
||||
ansible_connection: ansible.netcommon.network_cli
|
||||
ansible_network_os: community.network.voss
|
||||
ansible_user: myuser
|
||||
ansible_become: yes
|
||||
ansible_become: true
|
||||
ansible_become_method: enable
|
||||
ansible_password: !vault...
|
||||
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
|
||||
|
||||
@@ -26,7 +26,7 @@ become
|
||||
set to ``yes`` to activate privilege escalation.
|
||||
|
||||
become_user
|
||||
set to user with desired privileges — the user you `become`, NOT the user you login as. Does NOT imply ``become: yes``, to allow it to be set at host level. Default value is ``root``.
|
||||
set to user with desired privileges — the user you `become`, NOT the user you login as. Does NOT imply ``become: true``, to allow it to be set at host level. Default value is ``root``.
|
||||
|
||||
become_method
|
||||
(at play or task level) overrides the default method set in ansible.cfg, set to use any of the :ref:`become_plugins`.
|
||||
@@ -79,7 +79,7 @@ ansible_become_method
|
||||
which privilege escalation method should be used
|
||||
|
||||
ansible_become_user
|
||||
set the user you become through privilege escalation; does not imply ``ansible_become: yes``
|
||||
set the user you become through privilege escalation; does not imply ``ansible_become: true``
|
||||
|
||||
ansible_become_password
|
||||
set the privilege escalation password. See :ref:`playbooks_vault` for details on how to avoid having secrets in plain text
|
||||
@@ -300,7 +300,7 @@ As of version 2.6, Ansible supports ``become`` for privilege escalation (enterin
|
||||
|
||||
You must set the connection type to either ``connection: ansible.netcommon.network_cli`` or ``connection: ansible.netcommon.httpapi`` to use ``become`` for privilege escalation on network devices. Check the :ref:`platform_options` documentation for details.
|
||||
|
||||
You can use escalated privileges on only the specific tasks that need them, on an entire play, or on all plays. Adding ``become: yes`` and ``become_method: enable`` instructs Ansible to enter ``enable`` mode before executing the task, play, or playbook where those parameters are set.
|
||||
You can use escalated privileges on only the specific tasks that need them, on an entire play, or on all plays. Adding ``become: true`` and ``become_method: enable`` instructs Ansible to enter ``enable`` mode before executing the task, play, or playbook where those parameters are set.
|
||||
|
||||
If you see this error message, the task that generated it requires ``enable`` mode to succeed:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user