Using import_playbook and environment.

188 views
Skip to first unread message

Alex Walender

unread,
Nov 3, 2017, 8:48:24 AM11/3/17
to Ansible Project
Imagine following situation:

I have a big main.yaml playbook file, where I include roles and import many different other playbooks.
I am behind a corporate proxy which I have to include in the main playbook with the environment field.

For this I have an example of my main yaml file:
__________________________________________________
---
#FORCED ROLES
  - hosts: all
    become: true
    roles:
      - ANXS.nodejs
      - ANXS.fail2ban

   environment:
     http_proxy: http://some.proxy.de
     https_proxy: http://some.proxy.de

#OTHER PLAYBOOKS
  - import_playbook: ansible_playbooks/docker_setup.yaml
    environment:
     http_proxy: http://some.proxy.de
     https_proxy: http://some.proxy.de



  - import_playbook: ansible_playbooks/unipostgresql.yaml
    environment:
     http_proxy: http://some.proxy.de
     https_proxy: http://some.proxy.de

______________________________________________________

The roles are using the proxys as intended.
Sadly, the imported playbooks ignore the environment field and those 2 playbooks fail.
Is there a way to achieve this without MODIFYING each imported playbook?
Reply all
Reply to author
Forward
0 new messages