ansible-hashistack/roles/nomad/tasks/main.yml

50 lines
1.4 KiB
YAML
Raw Permalink Normal View History

2023-09-18 17:03:08 +02:00
---
- name: check version installed
ansible.builtin.command:
cmd: nomad --version
register: nomad_version_installed
changed_when: false
failed_when: false
- name: install nomad
ansible.builtin.include_tasks: "install_{{ ansible_distribution | lower }}_binary.yml"
when: nomad_installed_version is not defined or nomad_version not in nomad_version_installed.stdout
- name: setup configs
ansible.builtin.include_tasks: "setup_nomad_configs.yml"
- name: install cni plugins
ansible.builtin.include_tasks: "cni.yml"
- name: enable nomad
ansible.builtin.service:
name: nomad
state: restarted
enabled: true
become: true
- name: set namespaces
ansible.builtin.command:
cmd: nomad namespace apply -descr "{{ item }} namespace" {{ item }}
changed_when: false
failed_when: false
loop: "{{ nomad_namespaces }}"
2023-09-18 17:03:08 +02:00
run_once: true
2023-09-25 13:55:32 +02:00
- name: Setup csi plugins
ansible.builtin.include_tasks: "csi_plugins.yml"
loop:
- nfs-controller
- nfs-plugin-node
when: nomad_csi_volumes is defined
run_once: true
# We're playing with nfs csi plugin and cant create volumes automatically
# because every nomad volume maps to a nfs share, and those needs to be created
# in another server (FIXME)
# - name: Create csi volumes
# ansible.builtin.include_tasks: "csi_volumes.yml"
# loop: "{{ nomad_csi_volumes }}"
# when: nomad_csi_volumes is defined
# run_once: true