LoginSignup
2

More than 5 years have passed since last update.

Ansibleでプロキシを越えてyumを実行する

Last updated at Posted at 2019-03-18

Ansibleのyumモジュールを使ってミドルのインストールを行ったとき、
プロキシ環境下での実行時に設定でハマったときのメモ

proxy設定方法

environmentにproxy情報を指定する(varsに切り出す必要はとくにない)
設定はplaybook全体に適用されるので、roles内に定義したtask等にも設定が反映される

- name: test
  hosts: localhost
  gather_facts: yes

  vars:
    proxy_env:
      http_proxy: 192.168.100.10:80
      https_proxy: 192.168.100.10:80

  tasks:
  -name: httpd install
   yum:
     name: httpd
     state: present

  environment: "{{proxy_env}}"

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2