Update to 2023-07-03 15:00

This commit is contained in:
Daniel Berteaud
2023-07-03 15:00:09 +02:00
parent 590e8b5d83
commit 91f9384361
44 changed files with 426 additions and 429 deletions

View 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
- set_fact: consul_install_mode='none'
tags: consul
- name: Detect if consul is installed
stat: path=/usr/local/bin/consul
register: consul_bin
tags: consul
- when: not consul_bin.stat.exists
set_fact: consul_install_mode='install'
tags: consul
- when: consul_bin.stat.exists
block:
- name: Detect installed version
shell: /usr/local/bin/consul version | head -1 | perl -pe 's/Consul v(\d+(\.\d+)*)/$1/'
changed_when: False
register: consul_current_version
- set_fact: consul_current_version={{ consul_current_version.stdout }}
tags: consul
- when: consul_bin.stat.exists and consul_current_version != consul_version
set_fact: consul_install_mode='upgrade'
tags: consul

View File

@@ -0,0 +1,46 @@
---
- name: Install needed tools
package:
name: "{{ consul_packages }}"
tags: consul
# Migrate from the old vault role
- name: Check if consul is a link
stat: path=/usr/local/bin/vault
register: consul_link
tags: vault
- when: consul_link.stat.islnk is defined and consul_link.stat.islnk
block:
- name: Remove consul link
file: path=/usr/local/bin/consul state=absent
- set_fact: consul_install_mode='upgrade'
tags: vault
- when: consul_install_mode != 'none'
block:
- name: Download consul
get_url:
url: "{{ consul_archive_url }}"
dest: /tmp
checksum: sha256:{{ consul_archive_sha256 }}
- name: Extract the archive
unarchive:
src: "/tmp/consul_{{ consul_version }}_linux_amd64.zip"
dest: /usr/local/bin
include: consul
mode: 755
remote_src: True
tags: consul
- name: Install bash completion support
copy:
content: |
complete -C {{ consul_root_dir }}/bin/consul consul
dest: /etc/bash_completion.d/consul
mode: 0644
tags: consul

View File

@@ -0,0 +1,7 @@
---
- include_tasks: facts.yml
tags: always
- include_tasks: install.yml
tags: always