export AB_HOME=/et/dev/abinitio/abinitio-V3
export PATH=${AB_HOME}/bin:${PATH}
I have executed the env file using the below playbook and I tried to read the variables which are exported using the output1 which is a register variable in my playbook. But I am able to see my register variable is empty. Is there any way to get the variables which are all exported. I don't know the variables name which are present inside the file, So I am not able to use the ECHO command as well.
- hosts: dev
gather_facts: false
tasks:
- name: get the environment variables
shell: "su <id> & . ./.env"
args:
chdir: /path to the file
register: output1
- debug: var=output1.stdout_lines export AB_HOME=/et/dev/abinitio/abinitio-V3
export PATH=${AB_HOME}/bin:${PATH}- hosts: dev
gather_facts: false
tasks:
- name: get the environment variables
shell: "su <id> & . ./.env" #this command is to execute the env file and store the result
args:
chdir: /path to the file
register: output1 #for storing exported variables.
- debug: var=output1.stdout_lines #print exported variables (Here I am not getting anything the stdout is empty)Hi
Could you please tell clearly:
- What you are trying to achieve.
- How you are doing this.
- What problems you encounter.
- Which command did you run, and what output did you get from that
(copied as text, not as images/attachments/screenshots)
- What the relevant tasks/playbooks/code/variables look like
On Thu, 20 Feb 2020 at 10:55, Sivaraman P <shivar...@gmail.com> wrote:
>
> 0I have the env file which is present in target machine and it contain certain number of variables with export command(the export command itself was present inside the file).
>
> export AB_HOME=/et/dev/abinitio/abinitio-V3
> export PATH=${AB_HOME}/bin:${PATH}
>
> I have executed the env file using the below playbook and I tried to read the variables which are exported using the output1 which is a register variable in my playbook. But I am able to see my register variable is empty. Is there any way to get the variables which are all exported. I don't know the variables name which are present inside the file, So I am not able to use the ECHO command as well.
>
> - hosts: dev
> gather_facts: false
> tasks:
> - name: get the environment variables
> shell: "su <id> & . ./.env"
> args:
> chdir: /path to the file
> register: output1
>
> - debug: var=output1.stdout_lines
>
> --
> 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 ansible...@googlegroups.com.
export DEV_AIR_ROOT=${AB_AIR_ROOT}
after running the playbook, I tried to echo $DEV_AIR_ROOT, But I am getting output as ${AB_AIR_ROOT} instead of getting //devetl1/et/devctl/ee/rep/dev
--
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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5c7208fe-7172-41fd-ba4c-28767dc5cf8c%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwO8BkvHRrLri0EZMauRGF35m%3D0dAGgrE%3DGwcAftpW-ExQ%40mail.gmail.com.