From 4381336fbb2cc374fac561d1aee126401628bf8a Mon Sep 17 00:00:00 2001 From: nicpayne713 <32268273+nicpayne713@users.noreply.github.com> Date: Fri, 8 Oct 2021 15:27:33 -0500 Subject: [PATCH] Docs: issue 75922 add code-blocks to user_guide/playbooks_environment.rst (#75929) Add code-blocks in the 6 outlined examples from the Issue --- .../rst/user_guide/playbooks_environment.rst | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/docsite/rst/user_guide/playbooks_environment.rst b/docs/docsite/rst/user_guide/playbooks_environment.rst index 1a80864def0..4b58658181b 100644 --- a/docs/docsite/rst/user_guide/playbooks_environment.rst +++ b/docs/docsite/rst/user_guide/playbooks_environment.rst @@ -15,7 +15,9 @@ When you set a value with ``environment:`` at the play or block level, it is ava Setting the remote environment in a task ---------------------------------------- -You can set the environment directly at the task level:: +You can set the environment directly at the task level. + +.. code-block:: yaml - hosts: all remote_user: root @@ -29,7 +31,9 @@ You can set the environment directly at the task level:: environment: http_proxy: http://proxy.example.com:8080 -You can re-use environment settings by defining them as variables in your play and accessing them in a task as you would access any stored Ansible variable:: +You can re-use environment settings by defining them as variables in your play and accessing them in a task as you would access any stored Ansible variable. + +.. code-block:: yaml - hosts: all remote_user: root @@ -47,7 +51,9 @@ You can re-use environment settings by defining them as variables in your play a state: present environment: "{{ proxy_env }}" -You can store environment settings for re-use in multiple playbooks by defining them in a group_vars file:: +You can store environment settings for re-use in multiple playbooks by defining them in a group_vars file. + +.. code-block:: yaml --- # file: group_vars/boston @@ -58,7 +64,9 @@ You can store environment settings for re-use in multiple playbooks by defining http_proxy: http://proxy.bos.example.com:8080 https_proxy: http://proxy.bos.example.com:8080 -You can set the remote environment at the play level:: +You can set the remote environment at the play level. + +.. code-block:: yaml - hosts: testing @@ -74,7 +82,9 @@ These examples show proxy settings, but you can provide any number of settings t Working with language-specific version managers =============================================== -Some language-specific version managers (such as rbenv and nvm) require you to set environment variables while these tools are in use. When using these tools manually, you usually source some environment variables from a script or from lines added to your shell configuration file. In Ansible, you can do this with the environment keyword at the play level:: +Some language-specific version managers (such as rbenv and nvm) require you to set environment variables while these tools are in use. When using these tools manually, you usually source some environment variables from a script or from lines added to your shell configuration file. In Ansible, you can do this with the environment keyword at the play level. + +.. code-block:: yaml+jinja --- ### A playbook demonstrating a common npm workflow: @@ -116,7 +126,9 @@ Some language-specific version managers (such as rbenv and nvm) require you to s .. warning:: Environment variables are normally passed in clear text (shell plugin dependent) so they are not a recommended way of passing secrets to the module being executed. -You can also specify the environment at the task level:: +You can also specify the environment at the task level. + +.. code-block:: yaml+jinja --- - name: Install ruby 2.3.1