54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
- name: Create overlay network
|
|
hosts: nomad_instances
|
|
become: true
|
|
vars_files:
|
|
- vars/wesher_vars.yml
|
|
- vars/vault_wesher_vars.yml
|
|
vars:
|
|
wesher_key: "{{ wesher_key }}"
|
|
wesher_version: v0.2.6
|
|
wesher_arch_map:
|
|
x86_64: amd64
|
|
armv7l: arm
|
|
aarch64: arm64
|
|
wesher_arch: "{{ wesher_arch_map[ansible_architecture] }}"
|
|
# wesher_sha256_map:
|
|
# x86_64: 8c551ca211d7809246444765b5552a8d1742420c64eff5677d1e27a34c72aeef
|
|
# armv7l: 97f5bbf2b00b8b11a4ca224540bf9c1affdb15432c3b6ad8da4c1a7b6175eb5d
|
|
# aarch64: 507c6397d67ea90bddb3e1c06ec9d8e38d4342ed6f0f6b47855fecc9f1d6fae0
|
|
# wesher_checksum: sha256:{{ wesher_sha256_map[ansible_architecture] }}
|
|
wesher_checksum: sha256:https://github.com/costela/wesher/releases/download/{{ wesher_version }}/wesher.sha256sums
|
|
|
|
tasks:
|
|
- name: Download wesher
|
|
get_url:
|
|
url: https://github.com/costela/wesher/releases/download/{{ wesher_version }}/wesher-{{ wesher_arch }}
|
|
dest: /usr/local/sbin/wesher
|
|
checksum: "{{ wesher_checksum }}"
|
|
owner: root
|
|
mode: "0755"
|
|
|
|
- name: Install systemd unit
|
|
get_url:
|
|
url: https://github.com/costela/wesher/raw/{{ wesher_version }}/dist/wesher.service
|
|
dest: /etc/systemd/system/wesher.service
|
|
|
|
- name: Write wesher config
|
|
lineinfile:
|
|
path: /etc/default/wesher
|
|
create: true
|
|
regexp: "^{{ item.split('=')[0] }}"
|
|
line: "{{ item }}"
|
|
owner: root
|
|
mode: "0600"
|
|
loop:
|
|
- WESHER_CLUSTER_KEY={{ wesher_key }}
|
|
- WESHER_JOIN={% for host in ansible_play_hosts %}{{ hostvars[host].ansible_default_ipv4.address }}{% if not loop.last %},{% endif %}{% endfor %}
|
|
|
|
- name: Start wesher
|
|
systemd:
|
|
name: wesher.service
|
|
daemon_reload: true
|
|
state: started
|
|
enabled: true
|