ansible-nomad/tasks/main.yml

43 lines
960 B
YAML
Raw Normal View History

2022-03-13 15:03:33 +00:00
---
- name: Include OS-specific variables
include_vars: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_os_family }}.yml"
2022-06-06 16:21:42 +00:00
- name: add hashicorp repo
get_url:
url: "https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo"
dest: '/etc/yum.repos.d/hashicorp.repo'
owner: root
group: root
mode: 0644
when: ansible_os_family == "RedHat"
2022-03-13 15:03:33 +00:00
- name: install package
package:
name: "{{ nomad_os_package }}"
state: present
- name: create folder
file:
state: directory
mode: 0755
path: "{{nomad_data_dir }}"
- name: apply config template
block:
- name: server template
template:
src: config.hcl.j2
2022-09-18 12:52:07 +00:00
dest: /etc/nomad.d/defaults.hcl
2022-03-13 15:03:33 +00:00
mode: 0400
notify: restart nomad
- name: ensure service is started
systemd:
name: "{{ nomad_os_service }}"
state: started
enabled: True