handle version upgrades; new handler handling

This commit is contained in:
AndrewPaglusch
2021-12-17 23:27:23 -06:00
committed by Andrew Paglusch
parent b44af648f7
commit 1694340dfc
4 changed files with 25 additions and 3 deletions

View File

@@ -2,8 +2,12 @@
systemd:
name: nebula
state: restarted
when: inventory_hostname not in groups['nebula_lighthouse']
listen: "restart nebula"
- name: Restart Lighthouse
systemd:
name: lighthouse
state: restarted
when: inventory_hostname in groups['nebula_lighthouse']
listen: "restart nebula"

View File

@@ -18,7 +18,7 @@
owner: root
group: root
mode: '0400'
notify: Restart Lighthouse
notify: restart nebula
- name: Ensure lighthouse service exists
template:

View File

@@ -6,12 +6,30 @@
owner: root
group: root
- name: Check for existing Nebula install
stat:
path: '/opt/nebula/nebula'
register: installed_nebula_stats
- name: Get Nebula version (if installed)
command: "/opt/nebula/nebula -version"
register: installed_nebula_version_out
changed_when: False
failed_when: False
when: installed_nebula_stats.stat.exists
- name: Extract Nebula version from command output
set_fact:
installed_nebula_version: "{{ installed_nebula_version_out.stdout.split(' ')[1] }}"
when: installed_nebula_stats.stat.exists
- name: Download & Extract Nebula
unarchive:
src: "https://github.com/slackhq/nebula/releases/download/v{{ nebula_version }}/nebula-linux-{{ nebula_architectures[ansible_architecture] }}.tar.gz"
dest: "/opt/nebula"
remote_src: yes
creates: '/opt/nebula/nebula'
when: (installed_nebula_version|default(nebula_version) != nebula_version) or (not installed_nebula_stats.stat.exists)
notify: restart nebula
- name: Ensure Nebula binaries permissions are correct
file:

View File

@@ -46,7 +46,7 @@
owner: root
group: root
mode: '0400'
notify: Restart Nebula
notify: restart nebula
- name: Ensure Nebula service exists
template: