ansible-roles/roles/nomad/tasks/install.yml

56 lines
1.3 KiB
YAML

---
- name: Install needed tools
package:
name:
- tar
- zstd
- unzip
tags: nomad
- when: nomad_install_mode != 'none'
block:
- name: Download nomad
get_url:
url: "{{ nomad_archive_url }}"
dest: "{{ nomad_root_dir }}/tmp"
checksum: sha256:{{ nomad_archive_sha256 }}
- name: Extract the archive
unarchive:
src: "{{ nomad_root_dir }}/tmp/nomad_{{ nomad_version }}_linux_amd64.zip"
dest: "{{ nomad_root_dir }}/tmp"
remote_src: True
- name: Install nomad binary
copy:
src: "{{ nomad_root_dir }}/tmp/nomad"
dest: "{{ nomad_root_dir }}/bin/nomad"
remote_src: True
mode: 755
- name: Link in /usr/local/bin
file: src={{ nomad_root_dir }}/bin/nomad dest=/usr/local/bin/nomad state=link force=True
tags: nomad
- name: Install bash completion support
copy:
content: |
complete -C {{ nomad_root_dir }}/bin/nomad nomad
dest: /etc/bash_completion.d/nomad
mode: 755
tags: nomad
- name: Deploy systemd service unit
template: src=nomad.service.j2 dest=/etc/systemd/system/nomad.service
register: nomad_unit
notify: restart nomad
tags: nomad
- name: Reload systemd
systemd: daemon_reload=True
when: nomad_unit.changed
tags: nomad