feat(install): add skeleton for docker install

This commit is contained in:
Bertrand Lanson 2024-02-01 17:04:29 +01:00
parent 4fb90df5cc
commit 2de8c3fb1a
2 changed files with 31 additions and 6 deletions

View File

@ -5,6 +5,10 @@ deploy_haproxy_version: "2.6"
deploy_haproxy_env_variables: {} deploy_haproxy_env_variables: {}
# docker-only options
deploy_haproxy_container_expose_ports: []
deploy_haproxy_extra_container_volumes: []
# Options from the "default" config block in haproxy.cfg # Options from the "default" config block in haproxy.cfg
# The default values here are usually set, but you can change any of them. # The default values here are usually set, but you can change any of them.
deploy_haproxy_global: deploy_haproxy_global:
@ -12,8 +16,6 @@ deploy_haproxy_global:
- log /dev/log local1 notice - log /dev/log local1 notice
- stats socket {{ deploy_haproxy_socket }} level admin - stats socket {{ deploy_haproxy_socket }} level admin
- chroot {{ deploy_haproxy_chroot }} - chroot {{ deploy_haproxy_chroot }}
# - user {{ deploy_haproxy_user }}
# - group {{ deploy_haproxy_group }}
- daemon - daemon
- description hashistack haproxy - description hashistack haproxy
@ -29,17 +31,20 @@ deploy_haproxy_defaults:
deploy_haproxy_frontends: deploy_haproxy_frontends:
- name: default - name: default
options: options:
- description default frontend
- mode http - mode http
- bind :80 - bind :80
- default_backend default - default_backend default
- description nginx frontend
deploy_haproxy_backends: deploy_haproxy_backends:
- name: default - name: default
options: options:
- description default backend
- option forwardfor - option forwardfor
- server srv_nginx1 172.17.0.4:80 - option httpchk
- server srv_nginx2 172.17.0.3:80 - http-check send meth GET uri /
- server srv_nginx1 172.17.0.4:80 check inter 5s
- server srv_nginx2 172.17.0.3:80 check inter 5s
deploy_haproxy_listen: deploy_haproxy_listen:
- name: stats - name: stats
options: options:
@ -55,7 +60,8 @@ deploy_haproxy_listen:
options: options:
- bind :8000 - bind :8000
- mode http - mode http
- option httpchk GET /health HTTP/1.1\r\nHost:\ localhost - option httpchk
- http-check send meth GET uri /health ver HTTP/1.1 hdr Host localhost
- http-check expect status 200 - http-check expect status 200
- acl health_check_ok nbsrv() ge 1 - acl health_check_ok nbsrv() ge 1
- monitor-uri /health - monitor-uri /health

19
tasks/install_docker.yml Normal file
View File

@ -0,0 +1,19 @@
---
# task/install_docker file for deploy_haproxy
- name: "Update container volume list"
ansible.builtin.set_fact:
hashi_consul_container_volume_map: "{{ hashi_consul_container_volume_map + hashi_consul_extra_container_volumes }}"
- name: "Include ednxzu.docker_systemd_service"
ansible.builtin.include_role:
name: ednxzu.docker_systemd_service
vars:
docker_systemd_service_container_name: "consul"
docker_systemd_service_image: "{{ hashi_consul_docker_image }}:{{ hashi_consul_version }}"
docker_systemd_service_container_env: "{{ hashi_consul_env_variables }}"
docker_systemd_service_flags:
- network: host
- volume: "{{ hashi_consul_container_volume_map }}"
docker_systemd_service_name: "{{ docker_systemd_service_container_name }}_container"
docker_systemd_service_state: "{{ 'started' if hashi_consul_start_service else 'stopped'}}"
docker_systemd_service_restart: "{{ true if hashi_consul_start_service else false}}"