|
6 | 6 | - "{{ ansible_os_family }}.yml" |
7 | 7 | - default.yml |
8 | 8 |
|
9 | | -- name: 'Check epel repo' |
10 | | - shell: yum repolist | grep -qi EPEL |
11 | | - register: epel_repo_check |
12 | | - check_mode: false |
13 | | - when: ansible_pkg_mgr == "yum" |
14 | | - |
15 | | -- name: 'Add epel repo' |
16 | | - template: |
17 | | - src: "epel.repo" |
18 | | - dest: "/etc/yum.repos.d/epel.repo" |
19 | | - owner: "root" |
20 | | - group: "root" |
21 | | - mode: "0644" |
22 | | - when: ansible_pkg_mgr == "yum" and epel_repo_check is defined and epel_repo_check.rc != 0 |
23 | | - |
24 | | -- name: Add haproxy apt repo (jessie) |
25 | | - apt_repository: |
26 | | - repo: deb http://http.debian.net/debian {{ ansible_distribution_release }} main |
27 | | - state: present |
28 | | - update_cache: yes |
29 | | - when: ansible_distribution_release == 'jessie' |
30 | | - |
31 | | -- name: 'Add haproxy apt repo (Ubuntu)' |
32 | | - apt_repository: |
33 | | - repo: "ppa:vbernat/haproxy-1.5" |
34 | | - state: present |
35 | | - update_cache: yes |
36 | | - when: ansible_distribution == "Ubuntu" |
37 | | - |
38 | | -- name: Install HAProxy (yum) |
39 | | - yum: |
40 | | - name: "{{ haproxy_package_name }}" |
41 | | - when: ansible_pkg_mgr == "yum" |
42 | | - |
43 | | -- name: Install HAProxy (apt jessie) |
44 | | - apt: |
45 | | - name: "{{ haproxy_package_name }}" |
46 | | - default_release: "{{ansible_distribution_release}}" |
47 | | - when: ansible_distribution_release == 'jessie' |
48 | | - |
49 | | -- name: Install HAProxy (Ubuntu) |
50 | | - package: |
51 | | - name: "{{ haproxy_package_name }}" |
52 | | - when: ansible_distribution == 'Ubuntu' |
| 9 | +- name: Include distribution tasks |
| 10 | + include_tasks: "{{ item }}" |
| 11 | + with_first_found: |
| 12 | + - "install/{{ ansible_distribution }}.yml" |
| 13 | + - "install/{{ ansible_os_family }}.yml" |
53 | 14 |
|
54 | 15 | - name: Install supplementary packages |
55 | 16 | package: |
56 | | - name: "{{ item }}" |
57 | | - with_items: "{{ haproxy_extra_packages }}" |
| 17 | + name: "{{ haproxy_extra_packages }}" |
58 | 18 |
|
59 | 19 | - name: 'Enable it' |
60 | 20 | service: |
|
0 commit comments