Update to 2022-08-01 12:00

This commit is contained in:
Daniel Berteaud
2022-08-01 12:00:18 +02:00
parent 75fd1e984a
commit 1650198b44
8 changed files with 84 additions and 72 deletions

View File

@@ -1,12 +1,25 @@
---
- name: Detect installed version
block:
- import_tasks: ../includes/webapps_set_install_mode.yml
vars:
- root_dir: "{{ nomad_root_dir }}"
- version: "{{ nomad_version }}"
- set_fact: nomad_install_mode={{ install_mode | default('none') }}
- set_fact: nomad_current_version={{ current_version | default('') }}
- 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 -pe 's/Nomad v(\d+(\.\d+)*)\s.*/$1/'
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'

View File

@@ -6,10 +6,10 @@
state: "{{ (('tcp' in nomad_services[item].proto or 'udp' in nomad_services[item].proto) and nomad_services[item].src_ip | length > 0) | ternary('present', 'absent') }}"
rules: |
{% if 'tcp' in nomad_services[item].proto %}
-A INPUT -m state --state NEW -p tcp --dport {{ nomad_services[item].port }} -j ACCEPT
-A INPUT -m state --state NEW -p tcp --dport {{ nomad_services[item].port }} -s {{ nomad_services[item].src_ip | join(',') }} -j ACCEPT
{% endif %}
{% if 'udp' in nomad_services[item].proto %}
-A INPUT -m state --state NEW -p udp --dport {{ nomad_services[item].port }} -j ACCEPT
-A INPUT -m state --state NEW -p udp --dport {{ nomad_services[item].port }} -s {{ nomad_services[item].src_ip | join(',') }} -j ACCEPT
{% endif %}
loop: "{{ nomad_services.keys() | list }}"
tags: firewall,nomad

View File

@@ -27,9 +27,6 @@
- include_tasks: services.yml
tags: always
- include_tasks: write_version.yml
tags: always
- include_tasks: archive_post.yml
when: nomad_install_mode | default('none') == 'upgrade'
tags: always

View File

@@ -1,5 +0,0 @@
---
- name: Write installed version
copy: content={{ nomad_version }} dest={{ nomad_root_dir }}/meta/ansible_version
tags: nomad