|
6 | 6 | apt_key:
|
7 | 7 | url: "{{ item.key }}"
|
8 | 8 | state: present
|
9 |
| - with_items: "{{ apt_repository_keys }}" |
10 |
| - when: (proxy_env is not defined) or (proxy_env | length < 1) |
| 9 | + loop: "{{ apt_repository_keys }}" |
11 | 10 |
|
12 | 11 | - name: Add repository
|
13 | 12 | apt_repository:
|
14 | 13 | repo: "{{ item.repo }}"
|
15 | 14 | state: present
|
16 | 15 | update_cache: yes
|
17 |
| - with_items: "{{ apt_repository }}" |
18 |
| - when: (proxy_env is not defined) or (proxy_env | length < 1) |
19 |
| - |
20 |
| - |
21 |
| - - name: Add repository apt-key (behind a proxy) |
22 |
| - apt_key: |
23 |
| - url: "{{ item.key }}" |
24 |
| - state: present |
25 |
| - with_items: "{{ apt_repository_keys }}" |
26 |
| - environment: |
27 |
| - "{{ proxy_env }}" |
28 |
| - when: proxy_env | length > 0 |
29 |
| - |
30 |
| - - name: Add repository (behind a proxy) |
31 |
| - apt_repository: |
32 |
| - repo: "{{ item.repo }}" |
33 |
| - state: present |
34 |
| - update_cache: yes |
35 |
| - with_items: "{{ apt_repository }}" |
36 |
| - environment: |
37 |
| - "{{ proxy_env }}" |
38 |
| - when: proxy_env | length > 0 |
39 |
| - |
| 16 | + loop: "{{ apt_repository }}" |
| 17 | + environment: "{{ proxy_env | default(omit) }}" |
40 | 18 | when: ansible_os_family == "Debian"
|
41 | 19 | tags: add_repo
|
42 | 20 |
|
43 |
| - |
44 | 21 | # RedHat CentOS
|
45 | 22 | - block:
|
46 | 23 | - name: Add repository
|
|
49 | 26 | description: "{{ item.description }}"
|
50 | 27 | baseurl: "{{ item.baseurl }}"
|
51 | 28 | gpgkey: "{{ item.gpgkey }}"
|
52 |
| - with_items: "{{ yum_repository }}" |
53 |
| - when: (yum_repository length > 0) and (proxy_env is not defined or proxy_env | length < 1) |
54 |
| - |
55 |
| - - name: Add repository (behind a proxy) |
56 |
| - yum_repository: |
57 |
| - name: "{{ item.name }}" |
58 |
| - description: "{{ item.description }}" |
59 |
| - baseurl: "{{ item.baseurl }}" |
60 |
| - gpgkey: "{{ item.gpgkey }}" |
61 |
| - with_items: "{{ yum_repository }}" |
62 |
| - environment: |
63 |
| - "{{ proxy_env }}" |
64 |
| - when: (yum_repository length > 0) and (proxy_env | length > 0) |
65 |
| - |
| 29 | + loop: "{{ yum_repository | flatten(1) }}" |
| 30 | + when: yum_repository length > 0 |
| 31 | + |
| 32 | + # Install Epel Repository |
| 33 | + - name: Install | EPEL Repository |
| 34 | + package: |
| 35 | + name: epel-release |
| 36 | + when: install_epel_repo == "true" |
| 37 | + tags: install_epel_repo |
| 38 | + |
| 39 | + # Install PostgreSQL Repository |
| 40 | + - name: install | get pgdg-redhat-repo-latest.noarch.rpm |
| 41 | + get_url: |
| 42 | + url: "https://download.postgresql.org/pub/repos/yum/reporpms/EL-{{ ansible_distribution_major_version }}-x86_64/pgdg-redhat-repo-latest.noarch.rpm" |
| 43 | + dest: /tmp/ |
| 44 | + timeout: 30 |
| 45 | + validate_certs: no |
| 46 | + when: install_postgresql_repo == "true" |
| 47 | + tags: install_postgresql_repo |
| 48 | + |
| 49 | + - name: install | PostgreSQL repository |
| 50 | + package: |
| 51 | + name: /tmp/pgdg-redhat-repo-latest.noarch.rpm |
| 52 | + state: present |
| 53 | + when: install_postgresql_repo == "true" |
| 54 | + tags: install_postgresql_repo |
| 55 | + environment: "{{ proxy_env | default(omit) }}" |
66 | 56 | when: ansible_os_family == "RedHat"
|
67 | 57 | tags: add_repo
|
68 |
| - |
0 commit comments