mirror of https://github.com/Aidaho12/haproxy-wi
83 lines
2.3 KiB
YAML
83 lines
2.3 KiB
YAML
![]() |
- name: install EPEL Repository
|
||
|
yum:
|
||
|
name: epel-release
|
||
|
state: latest
|
||
|
disable_gpg_check: yes
|
||
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and HAPVER|length > 0
|
||
|
ignore_errors: yes
|
||
|
environment:
|
||
|
http_proxy: "{{PROXY}}"
|
||
|
https_proxy: "{{PROXY}}"
|
||
|
|
||
|
|
||
|
- name: install HAProxy {{HAPVER}} on EL{{ansible_facts['distribution_major_version']}}
|
||
|
yum:
|
||
|
name:
|
||
|
- http://repo.roxy-wi.org/haproxy-{{HAPVER}}.el{{ansible_facts['distribution_major_version']}}.x86_64.rpm
|
||
|
- socat
|
||
|
- rsyslog
|
||
|
state: present
|
||
|
disable_gpg_check: yes
|
||
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and HAPVER|length > 0
|
||
|
ignore_errors: yes
|
||
|
register: install_result
|
||
|
environment:
|
||
|
http_proxy: "{{PROXY}}"
|
||
|
https_proxy: "{{PROXY}}"
|
||
|
|
||
|
|
||
|
- name: Try to install another HAProxy {{HAPVER}} on EL{{ansible_facts['distribution_major_version']}}
|
||
|
yum:
|
||
|
name:
|
||
|
- http://repo1.roxy-wi.org/haproxy-{{HAPVER}}.el{{ansible_facts['distribution_major_version']}}.x86_64.rpm
|
||
|
- socat
|
||
|
- rsyslog
|
||
|
- bind-utils
|
||
|
state: present
|
||
|
register: install_result1
|
||
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ("'timed out' in install_result.stderr")
|
||
|
ignore_errors: yes
|
||
|
environment:
|
||
|
http_proxy: "{{PROXY}}"
|
||
|
https_proxy: "{{PROXY}}"
|
||
|
|
||
|
|
||
|
- name: set_fact from wi`
|
||
|
set_fact:
|
||
|
haproxy_from_wi: "yes"
|
||
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and HAPVER|length > 0
|
||
|
|
||
|
|
||
|
- name: install the latest version of HAProxy
|
||
|
yum:
|
||
|
name:
|
||
|
- haproxy
|
||
|
- socat
|
||
|
- rsyslog
|
||
|
state: latest
|
||
|
when: (ansible_facts['os_family'] == "RedHat" or ansible_facts['os_family'] == 'CentOS') and ("'FAILED' in install_result1.stderr")
|
||
|
environment:
|
||
|
http_proxy: "{{PROXY}}"
|
||
|
https_proxy: "{{PROXY}}"
|
||
|
|
||
|
|
||
|
- name: Install HAProxy
|
||
|
apt:
|
||
|
name:
|
||
|
- haproxy
|
||
|
- socat
|
||
|
- rsyslog
|
||
|
state: present
|
||
|
when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu'
|
||
|
environment:
|
||
|
http_proxy: "{{PROXY}}"
|
||
|
https_proxy: "{{PROXY}}"
|
||
|
|
||
|
- name: Enable and start service HAProxy
|
||
|
systemd:
|
||
|
name: haproxy
|
||
|
daemon_reload: yes
|
||
|
state: started
|
||
|
enabled: yes
|
||
|
force: no
|