Help with conditional for environment variables

25 views
Skip to first unread message

Alejandro

unread,
Sep 17, 2015, 2:07:59 PM9/17/15
to ansible...@googlegroups.com
Hi, 

I has a common roles, where I install all base packages.

Now we has some environments where need proxy and others where is not needed.

- name: Epel repo OracleLinux
  yum: name=http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm state=present
  when: ansible_distribution == 'OracleLinux'
  environment: proxy_env

Some way to add 
  environment: proxy_env
 just in some cases?

Thanks!
Ale

Brian Coca

unread,
Sep 21, 2015, 3:40:19 PM9/21/15
to Ansible Project
set diff versions proxy_env in group_vars/{has_env1,has_no_env} so
each group will get the environment they need

also use like:

environment: "{{proxy_env}}"

for the empty you can set:

proxy_env: {}

--
Brian Coca
Reply all
Reply to author
Forward
0 new messages