mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-07 17:16:55 +02:00
Update to 2022-09-02 18:00
This commit is contained in:
36
roles/consul_template/tasks/facts.yml
Normal file
36
roles/consul_template/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: consul,vault
|
||||
|
||||
- set_fact: consul_tpl_install_mode='none'
|
||||
tags: consul,vault
|
||||
|
||||
- name: Detect if consul_tpl is installed
|
||||
stat: path=/usr/local/bin/consul_tpl
|
||||
register: consul_tpl_bin
|
||||
tags: consul,vault
|
||||
|
||||
- when: not consul_tpl_bin.stat.exists
|
||||
set_fact: consul_tpl_install_mode='install'
|
||||
tags: consul,vault
|
||||
|
||||
- when: consul_tpl_bin.stat.exists
|
||||
block:
|
||||
- name: Detect installed version
|
||||
shell: /usr/local/bin/consul-template -version | perl -pe 's/consul\-template v(\d+(\.\d+)*).*/$1/'
|
||||
changed_when: False
|
||||
register: consul_tpl_current_version
|
||||
- set_fact: consul_tpl_current_version={{ consul_tpl_current_version.stdout }}
|
||||
tags: consul,vault
|
||||
|
||||
- when: consul_tpl_bin.stat.exists and consul_tpl_current_version != consul_tpl_version
|
||||
set_fact: consul_tpl_install_mode='upgrade'
|
||||
tags: consul,vault
|
||||
|
Reference in New Issue
Block a user