From 385788f9bfaa64fde3fd9dbdcfe9c36065598ae3 Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 8 Oct 2022 09:28:44 +0200 Subject: [PATCH] add empty nomad file for red hat --- tasks/main.yml | 25 ++++++++++++++++--------- templates/empty.j2 | 0 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 templates/empty.j2 diff --git a/tasks/main.yml b/tasks/main.yml index aa0abe9..33316f4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,7 +6,7 @@ - "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml" - "{{ ansible_os_family }}.yml" -- name: add hashicorp repo +- name: Add hashicorp repo get_url: url: "https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo" dest: '/etc/yum.repos.d/hashicorp.repo' @@ -15,28 +15,35 @@ mode: 0644 when: ansible_os_family == "RedHat" -- name: install package +- name: Install package package: name: "{{ nomad_os_package }}" state: present -- name: create folder +- name: Create folder file: state: directory mode: 0755 - path: "{{nomad_data_dir }}" + path: "{{ nomad_data_dir }}" -- name: apply config template + +- name: Apply config template + notify: restart nomad block: - - name: server template + - name: Server template template: src: config.hcl.j2 dest: /etc/nomad.d/defaults.hcl 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: name: "{{ nomad_os_service }}" state: started - enabled: True + enabled: true diff --git a/templates/empty.j2 b/templates/empty.j2 new file mode 100644 index 0000000..e69de29