Update to 2023-07-08 16:00

This commit is contained in:
Daniel Berteaud
2023-07-08 16:00:11 +02:00
parent f16dd6e98d
commit d87c1bdc89
60 changed files with 708 additions and 439 deletions

View File

@@ -0,0 +1,9 @@
---
# Version of Nomad to install
nomad_version: 1.5.6
# URL of the archive
nomad_archive_url: https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_linux_amd64.zip
# Expected sha256 of the archive
nomad_archive_sha256: 65a7d5a4c6ade01a44292901b05a7c985b4459e0a079b5eb55f5d61474ee98e5

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: 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

View File

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

View File

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

View File

@@ -0,0 +1,8 @@
---
nomad_packages:
- tar
- zstd
- unzip
- acl