Difference between revisions of "Configuring proxy using environment variables"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>Ansible_tips_and_tricks|Ansible tips and tricks</yambe:breadcrumb> =Configuring proxy using environment variables= To configure proxy using environment vari...")
(No difference)

Revision as of 04:26, 10 March 2015

<yambe:breadcrumb>Ansible_tips_and_tricks|Ansible tips and tricks</yambe:breadcrumb>

Configuring proxy using environment variables

To configure proxy using environment variables, esp for modules such as get_url or yum use:

vars:
  proxy_env:
    http_proxy: http://proxy.virtual-labs.ac.in:8080/
    https_proxy: http://proxy.virtual-labs.ac.in:8080/

Then the same can be referred into various tasks as:

  - name: Download GLPI from Internet
    get_url: url="{{ glpi_download_url }}"  dest="{{ glpi_local_path }}"
    environment: proxy_env

  - name: Install apache, mod_ssl, php, php-ldap, mysql-server, php-mysql, php-mbstring, php-gd 
    yum: name={{ item }} state=present
    with_items:
      - httpd
      - mod_ssl
      - php
      - php-ldap
      - mysql-server
      - php-mysql
      - php-mbstring
      - php-gd
      - MySQL-python
    environment: proxy_env
    notify:
      - restart apache