0

I was trying to run the following in Ansible:

This didn't work, it ran through but didn't actually export the HTTP address. I have also tried to put it into a bash script and run this, but this also didn't work. I'm sure there is an easy fix that I don't see...

...help is much appreciated!

1 Answers1

0

The most common way to do this, is to use the environment specifier in your task. Within it you also are able to set different environment variables to different tasks. Also described here: Ansible Playbook Environments

 - name: Install cobbler
   package:
     name: cobbler
     state: present
   environment:
     http_proxy: http://proxy.example.com:8080

If you have to persist the environment variable I recommend to use the ~/.bashrc or the /etc/profile Files.

You can use a template or file task or line in file manipulations in your playbook therefor.

Here you can find further information: How to set Linux environment variables with Ansible

bswe
  • 100
  • 1
  • 1
  • 8