initial commit for ansible haproxy role

This commit is contained in:
Michael Rennecke
2019-03-20 19:50:49 +01:00
parent e545c85ed3
commit 1fa96a719b
11 changed files with 363 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
---
- name: install dependencies
apt:
name:
- liblua5.3-0
- libpcre3
state: latest
- name: conflicted with haproxy package
apt:
name:
- haproxy
state: absent
- name: add user 'haproxy'
user:
name: haproxy
system: yes
create_home: no
- name: create config dir
file:
path: /etc/haproxy/
state: directory
- name: copy errorcodes
copy:
src: errorfiles
dest: /etc/haproxy/
- name: copy haproxy binary
copy:
src: haproxy
dest: /usr/local/bin
mode: 0755
notify:
- restart haproxy
- name: copy scripts
copy:
src: update_haproxy_certs.sh
dest: /usr/local/bin
mode: 0755
- name: create basic HAProxy configs
template:
src: "{{ item }}"
dest: "/etc/haproxy/{{ item }}"
mode: 0644
with_items:
- hostname2backend.map
- haproxy.cfg
notify: reload haproxy
- name: create domains.txt
template:
src: domains.txt
dest: /etc/haproxy/
mode: 0644
notify:
- update certs
- name: systemd unit
copy:
src: haproxy.service
dest: /lib/systemd/system/
mode: 0644
notify:
- reload systemd config
- reload haproxy
- name: haproxy service
service:
name: haproxy
enabled: yes
state: started