Update to 2022-07-23 14:00

This commit is contained in:
Daniel Berteaud 2022-07-23 14:00:15 +02:00
parent 5d2e9f2e70
commit d44b7ae506
7 changed files with 37 additions and 11 deletions

View File

@ -70,6 +70,8 @@ consul_base_conf:
enabled: "{{ (inventory_hostname in consul_servers) | ternary(True, False) }}"
connect:
enabled: "{{ (inventory_hostname in consul_servers) | ternary(True, False) }}"
performance:
raft_multiplier: 1
# For example
# consul_extra_conf:

View File

@ -1,6 +1,12 @@
---
- name: Deploy consul configuration
template: src=consul.json.j2 dest={{ consul_root_dir }}/etc/consul.json owner=root group={{ consul_user }} mode=640
notify: reload consul
template:
src: consul.json.j2
dest: "{{ consul_root_dir }}/etc/consul.json"
owner: root
group: "{{ consul_user }}"
mode: 640
validate: consul validate %s
notify: restart consul
tags: consul

View File

@ -53,3 +53,9 @@
when: consul_unit.changed
tags: consul
- name: Install backup hooks
template: src={{ item }}-backup.j2 dest=/etc/backup/{{ item }}.d/consul mode=755
loop:
- pre
- post
tags: consul

View File

@ -0,0 +1,4 @@
#!/bin/sh
set -eo pipefail
rm -f {{ consul_root_dir }}/backup/consul.snap

View File

@ -0,0 +1,4 @@
#!/bin/sh
set -eo pipefail
consul snapshot save {{ consul_root_dir }}/backup/consul.snap

View File

@ -18,19 +18,21 @@ nomad_user: "{{ nomad_conf.client.enabled | ternary('root', 'nomad') }}"
nomad_servers: []
# Ports used by Nomad, the protocols, and the list of IP/CIDR for which the ports will be opened in the firewall
nomad_services:
nomad_base_services:
http_api:
port: 4646
port: "{{ nomad_conf.ports.http | default(4646) }}"
proto: [tcp]
src_ip: []
rpc:
port: 4647
port: "{{ nomad_conf.ports.rpc | default(4647) }}"
proto: [tcp]
src_ip: []
serf:
port: 4648
port: "{{ nomad_conf.ports.serf | default(4648) }}"
proto: [tcp,udp]
src_ip: []
nomad_extra_services: {}
nomad_services: "{{ nomad_base_services | combine(nomad_extra_services, recursive=True) }}"
# Nomad configuration (which will be converted to JSON)
# The configuration is splited in a base conf, an extra conf, and a host conf so you can override part of the config easily
@ -47,10 +49,6 @@ nomad_base_conf:
server_join:
retry_join: "{{ (inventory_hostname in nomad_servers) | ternary(nomad_servers, []) }}"
bootstrap_expect: "{{ nomad_servers | length }}"
ports:
http: "{{ nomad_services.http_api.port }}"
rpc: "{{ nomad_services.rpc.port }}"
serf: "{{ nomad_services.serf.port }}"
# For example
# nomad_extra_conf:

View File

@ -1,6 +1,12 @@
---
- name: Deploy nomad configuration
template: src=nomad.json.j2 dest={{ nomad_root_dir }}/etc/nomad.json owner=root group={{ nomad_user }} mode=640
template:
src: nomad.json.j2
dest: "{{ nomad_root_dir }}/etc/nomad.json"
owner: root
group: "{{ nomad_user }}"
mode: 640
validate: nomad config validate %s
notify: restart nomad
tags: nomad