f29aa2da16
This makes the haproxy role more generic so we can run another (or potentially even more) haproxy instance(s) to manage other services. The config file is moved to a variable for the haproxy role. The gitea specific config is then installed for the gitea-lb service by a new gitea-lb role. statsd reporting is made optional with an argument. This enables/disables the service in the docker compose. Role documenation is updated. Needed-By: https://review.opendev.org/678159 Change-Id: I3506ebbed9dda17d910001e71b17a865eba4225d
59 lines
1.2 KiB
YAML
59 lines
1.2 KiB
YAML
- name: Install socat for haproxy management
|
|
package:
|
|
name: socat
|
|
state: present
|
|
|
|
- name: Ensure registry volume directories exists
|
|
file:
|
|
state: directory
|
|
path: "/var/haproxy/{{ item }}"
|
|
owner: 1000
|
|
group: 1000
|
|
loop:
|
|
- etc
|
|
- run
|
|
|
|
- name: Ensure haproxy config template available
|
|
assert:
|
|
that:
|
|
- haproxy_config_template is defined
|
|
|
|
- name: Write haproxy config file
|
|
template:
|
|
src: '{{ haproxy_config_template }}'
|
|
dest: /var/haproxy/etc/haproxy.cfg
|
|
owner: 1000
|
|
group: 1000
|
|
mode: 0644
|
|
|
|
- name: Ensure docker compose configuration directory
|
|
file:
|
|
path: /etc/haproxy-docker
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
|
|
- name: Install docker-compose configuration
|
|
template:
|
|
src: docker-compose.yaml.j2
|
|
dest: /etc/haproxy-docker/docker-compose.yaml
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
|
|
notify: Reload haproxy
|
|
- name: Run docker-compose pull
|
|
shell:
|
|
cmd: docker-compose pull
|
|
chdir: /etc/haproxy-docker/
|
|
|
|
- name: Run docker-compose up
|
|
shell:
|
|
cmd: docker-compose up -d
|
|
chdir: /etc/haproxy-docker/
|
|
|
|
- name: Run docker prune to cleanup unneeded images
|
|
shell:
|
|
cmd: docker image prune -f
|