ansible-roles/roles/nomad/tasks/archive_pre.yml
2022-08-06 12:00:17 +02:00

26 lines
751 B
YAML

---
- name: Create the archive dir
file: path={{ nomad_root_dir }}/archives/{{ nomad_current_version }} state=directory
tags: nomad
- name: Snapshot nomad data
command: "{{ nomad_root_dir }}/bin/nomad operator snapshot save {{ nomad_root_dir }}/archives/{{ nomad_current_version }}/nomad.snap"
args:
creates: "{{ nomad_root_dir }}/archives/{{ nomad_current_version }}/nomad.snap"
environment:
NOMAD_TOKEN: "{{ nomad_mgm_token | default(omit) }}"
tags: nomad
- name: Backup previous version
synchronize:
src: "{{ nomad_root_dir }}/{{ item }}"
dest: "{{ nomad_root_dir }}/archives/{{ nomad_current_version }}/"
compress: False
delegate_to: "{{ inventory_hostname }}"
loop:
- bin
- plugins
tags: nomad