add empty nomad file for red hat

This commit is contained in:
vincent 2022-10-08 09:28:44 +02:00
parent d490bceada
commit 385788f9bf
2 changed files with 16 additions and 9 deletions

View File

@ -6,7 +6,7 @@
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml" - "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ ansible_os_family }}.yml" - "{{ ansible_os_family }}.yml"
- name: add hashicorp repo - name: Add hashicorp repo
get_url: get_url:
url: "https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo" url: "https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo"
dest: '/etc/yum.repos.d/hashicorp.repo' dest: '/etc/yum.repos.d/hashicorp.repo'
@ -15,28 +15,35 @@
mode: 0644 mode: 0644
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: install package - name: Install package
package: package:
name: "{{ nomad_os_package }}" name: "{{ nomad_os_package }}"
state: present state: present
- name: create folder - name: Create folder
file: file:
state: directory state: directory
mode: 0755 mode: 0755
path: "{{ nomad_data_dir }}" path: "{{ nomad_data_dir }}"
- name: apply config template
- name: Apply config template
notify: restart nomad
block: block:
- name: server template - name: Server template
template: template:
src: config.hcl.j2 src: config.hcl.j2
dest: /etc/nomad.d/defaults.hcl dest: /etc/nomad.d/defaults.hcl
mode: 0400 mode: 0400
notify: restart nomad - name: Empty nomad.hcl
template:
src: empty.j2
dest: /etc/nomad.d/nomad.hcl
mode: 0400
when: ansible_os_family == "RedHat"
- name: ensure service is started - name: Ensure service is started
systemd: systemd:
name: "{{ nomad_os_service }}" name: "{{ nomad_os_service }}"
state: started state: started
enabled: True enabled: true

0
templates/empty.j2 Normal file
View File