What is the way to access shell environment variables in Ansible?

devquora
devquora

Posted On: Feb 22, 2018

 

The user needs to use the ‘env’ lookup plugin in order to access the existing variables. If you want to access the value of the office environment on the management machine, you need to write the following code.

  1. _ _ _
  2. # . . .
  3. vars :
  4. local_home : “{{ lookup(‘env’,’Office’) }}
  5. I
  6. {{ ansible_env . SOME_VARIABLE }}

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Ansible Interview Questions

    What is Ansible?

    Ansible is an open source automation platform which can help you with configuration management, task automation and appl..

    Ansible Interview Questions

    Talk about Ansible architecture.

    Ansible works on ‘agentless architecture’. It works by connecting to your nodes and pushes out Ansible modules to th..

    Ansible Interview Questions

    List some advantages of using Ansible.

    Unlike other configuration management system, Ansible is the most sought after software applications these days. it off..