mirror of https://github.com/Aidaho12/haproxy-wi
52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
---
|
|
- name: Ensuring config directories exist.
|
|
file:
|
|
path: "{{ HAP_DIR }}"
|
|
state: "directory"
|
|
owner: "{{ansible_user}}"
|
|
group: "{{ansible_user}}"
|
|
mode: "0770"
|
|
become: true
|
|
ignore_errors: yes
|
|
|
|
- name: Copying over haproxy.cfg.
|
|
template:
|
|
src: ../../haproxy/templates/haproxy.cfg.j2
|
|
dest: "{{ HAP_DIR }}/haproxy.cfg"
|
|
mode: "0666"
|
|
owner: "{{ansible_user}}"
|
|
group: "{{ansible_user}}"
|
|
force: no
|
|
become: true
|
|
ignore_errors: yes
|
|
|
|
- name: Add logs tasks.
|
|
include_tasks: ../../haproxy/tasks/logs.yml
|
|
|
|
- name: Setting sysctl values.
|
|
sysctl:
|
|
name: "{{ item.name }}"
|
|
value: "{{ item.value }}"
|
|
sysctl_set: yes
|
|
become: true
|
|
with_items:
|
|
- { name: "net.ipv4.ip_nonlocal_bind", value: 1}
|
|
- { name: "net.ipv6.ip_nonlocal_bind", value: 1}
|
|
- { name: "net.unix.max_dgram_qlen", value: 128}
|
|
|
|
- name: Create HAProxy.
|
|
docker_container:
|
|
name: "{{ CONT_NAME }}"
|
|
image: "haproxytech/haproxy-alpine:{{haproxy_version}}"
|
|
recreate: yes
|
|
network_mode: host
|
|
volumes:
|
|
- "{{ HAP_DIR }}:/usr/local/etc/haproxy:rw"
|
|
- "/tmp:/tmp:ro"
|
|
vars:
|
|
ansible_python_interpreter: /usr/bin/python3
|
|
|
|
- name: Add syn_flood tasks.
|
|
include_tasks: ../../haproxy/tasks/syn_flood.yml
|
|
when: (SYN_FLOOD is defined) and (SYN_FLOOD|length > 0)
|