GHP publish

This commit is contained in:
ace
2021-01-09 20:54:42 +03:00
commit b4b740a239
173 changed files with 5392 additions and 0 deletions

View File

@ -0,0 +1,3 @@
dockerize: false
namespace: haproxy
haproxy_image_tag: 2.3.1

View File

@ -0,0 +1,22 @@
---
- name: restart haproxy
become: true
systemd:
name: haproxy
state: restarted
daemon_reload: yes
- name: restart docker haproxy
docker_container:
name: "haproxy"
image: "{{ docker_registry }}/haproxy:{{ haproxy_image_tag }}"
state: started
restart: yes
ports:
- "443:443"
container_default_behavior: no_defaults
detach: true
restart_policy: unless-stopped
volumes:
- "/opt/haproxy/conf.d:/usr/local/etc/haproxy/conf.d"

View File

View File

@ -0,0 +1,26 @@
---
- name: Create configuration dir for {{ namespace }}
file:
name: "/opt/haproxy/conf.d"
state: directory
- name: Copy haproxy configuration files for {{ namespace }}
copy:
content: "{{ item.data }}"
dest: "/opt/haproxy/conf.d/{{ item.name }}"
loop: "{{ haproxy['conf.d'] }}"
when: haproxy['conf.d'] is defined
notify: restart docker haproxy
- name: Start haproxy in docker for {{ namespace }}
docker_container:
name: "haproxy"
image: "{{ docker_registry }}/haproxy:{{ haproxy_image_tag }}"
state: started
ports:
- "443:443"
container_default_behavior: no_defaults
detach: true
restart_policy: unless-stopped
volumes:
- "/opt/haproxy/conf.d:/usr/local/etc/haproxy/conf.d"

View File

@ -0,0 +1,10 @@
- block:
- import_tasks: package.yml
when: not dockerize
become: true
- block:
- import_tasks: docker.yml
when: dockerize
become: true

View File

@ -0,0 +1,22 @@
---
- block:
- name: install haproxy
package:
name: haproxy
state: present
- name: add haproxy config
copy:
content: "{{ haproxy_config }}"
dest: "/etc/haproxy/haproxy.cfg"
notify:
- restart haproxy
when: haproxy_config is defined
- name: start haproxy service
systemd:
name: haproxy
state: started
enabled: yes
daemon_reload: yes