mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-29 18:55:34 +02:00
Update to 2023-07-08 16:00
This commit is contained in:
36
roles/nomad_bin/tasks/facts.yml
Normal file
36
roles/nomad_bin/tasks/facts.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
# 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
|
||||
|
||||
- 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
|
||||
block:
|
||||
- name: Detect installed version
|
||||
shell: /usr/local/bin/nomad version | perl -ne '/Nomad v(\d+(\.\d+)*)\s.*/ && print "$1\n"'
|
||||
changed_when: False
|
||||
register: nomad_current_version
|
||||
- set_fact: nomad_current_version={{ nomad_current_version.stdout }}
|
||||
tags: nomad
|
||||
|
||||
- when: nomad_bin.stat.exists and nomad_current_version != nomad_version
|
||||
set_fact: nomad_install_mode='upgrade'
|
||||
tags: nomad
|
||||
|
Reference in New Issue
Block a user