2022-07-21 01:00:17 +02:00
|
|
|
---
|
|
|
|
|
2022-08-03 01:00:22 +02:00
|
|
|
# Load distribution specific variables
|
|
|
|
- include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- "{{ role_path }}/vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
|
|
|
|
- "{{ role_path }}/vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
|
|
|
|
- "{{ role_path }}/vars/{{ ansible_distribution }}.yml"
|
|
|
|
- "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
|
|
|
|
tags: nomad
|
|
|
|
|
2022-08-01 12:00:18 +02:00
|
|
|
- set_fact: nomad_install_mode='none'
|
|
|
|
tags: nomad
|
|
|
|
|
|
|
|
- name: Detect if nomad is installed
|
|
|
|
stat: path=/usr/local/bin/nomad
|
|
|
|
register: nomad_bin
|
|
|
|
tags: nomad
|
|
|
|
|
|
|
|
- when: not nomad_bin.stat.exists
|
|
|
|
set_fact: nomad_install_mode='install'
|
|
|
|
tags: nomad
|
|
|
|
|
|
|
|
- when: nomad_bin.stat.exists
|
2022-07-21 01:00:17 +02:00
|
|
|
block:
|
2022-08-01 12:00:18 +02:00
|
|
|
- name: Detect installed version
|
|
|
|
shell: /usr/local/bin/nomad version | perl -pe 's/Nomad v(\d+(\.\d+)*)\s.*/$1/'
|
|
|
|
changed_when: False
|
|
|
|
register: nomad_current_version
|
|
|
|
- set_fact: nomad_current_version={{ nomad_current_version.stdout }}
|
2022-07-21 01:00:17 +02:00
|
|
|
tags: nomad
|
|
|
|
|
2022-08-01 12:00:18 +02:00
|
|
|
- when: nomad_bin.stat.exists and nomad_current_version != nomad_version
|
|
|
|
set_fact: nomad_install_mode='upgrade'
|
2022-08-06 12:00:17 +02:00
|
|
|
tags: nomad
|
2022-08-03 01:00:22 +02:00
|
|
|
|
|
|
|
- name: Build a list of enabled task drivers
|
|
|
|
set_fact: nomad_enabled_task_drivers={{ nomad_conf.client.task_drivers | dict2items | selectattr('value.enabled', 'equalto', True) | map(attribute='key') }}
|
|
|
|
tags: nomad
|
2022-08-03 16:00:16 +02:00
|
|
|
|
|
|
|
|