mirror of
https://github.com/davestephens/ansible-nas
synced 2025-01-14 12:33:57 +00:00
39 lines
1,008 B
YAML
39 lines
1,008 B
YAML
---
|
|
- name: Install and start Nomad
|
|
block:
|
|
- name: Add Hashicorp GPG key
|
|
ansible.builtin.apt_key:
|
|
url: https://apt.releases.hashicorp.com/gpg
|
|
state: present
|
|
|
|
- name: Add Hashicorp apt repository
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb https://apt.releases.hashicorp.com {{ ansible_facts['lsb']['codename'] }} main"
|
|
state: present
|
|
filename: hashicorp
|
|
|
|
- name: Install Nomad
|
|
ansible.builtin.apt:
|
|
name: nomad
|
|
state: present
|
|
|
|
- name: Template Nomad config
|
|
ansible.builtin.template:
|
|
src: nomad.hcl
|
|
dest: /etc/nomad.d/nomad.hcl
|
|
|
|
- name: Start Nomad
|
|
ansible.builtin.systemd:
|
|
name: "{{ nomad_service_name }}"
|
|
state: started
|
|
enabled: yes
|
|
when: nomad_enabled is true
|
|
|
|
- name: Stop Nomad
|
|
block:
|
|
- name: Stop Nomad
|
|
ansible.builtin.systemd:
|
|
name: "{{ nomad_service_name }}"
|
|
state: stopped
|
|
enabled: no
|
|
when: nomad_enabled is false
|