add yardstick iruya 9.0.0 release notes
[yardstick.git] / ansible / roles / set_package_installer_proxy / tasks / RedHat.yml
1 # Copyright (c) 2016-2017 Intel Corporation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 ---
15   # must do this before setting yum proxy
16   - name: find yum/dnf config
17     stat: "path={{ item }}"
18     register: packager_conf_stat
19     with_items:
20       - /etc/yum.conf
21       - /etc/dnf/dnf.conf
22
23   - name: insert yum/dnf proxy(http)
24     # insert after [main] section
25     lineinfile:
26       dest: "{{ item.stat.path }}"
27       state: present
28       regexp: "^proxy\\s*=\\s*{{ proxy_env.http_proxy }}"
29       insertafter: "^\\[main\\]"
30       line: "proxy={{ proxy_env.http_proxy }}"
31     when: '"http_proxy" in proxy_env and item.stat.isreg is defined and item.stat.isreg'
32     with_items: "{{ packager_conf_stat.results }}"
33
34   - name: verify proxy
35     command: "grep proxy= {{ item.stat.path }}"
36     when: 'item.stat.isreg is defined and item.stat.isreg'
37     with_items: "{{ packager_conf_stat.results }}"
38     register: yum_proxy_lines
39
40   - name: yum disable fastest mirrors
41     include: yum_disable_fastestmirrors.yml
42     when: ansible_pkg_mgr == 'yum'
43
44   - name: Test proxy connection
45     # try workaround call makecache directly
46     # yum module was failing for some reason
47     async: "{{ connection_timeout }}"
48     command: "{{ ansible_pkg_mgr }} -d2 -y makecache"
49     poll: 0
50     register: test_proxy_job_id