Infra: Cleanup Nomad configs
[csit.git] / fdio.infra.ansible / roles / nomad / tasks / main.yaml
index 54e8051..997b1e9 100644 (file)
@@ -3,7 +3,7 @@
 
 - name: Inst - Update Package Cache (APT)
   apt:
-    update_cache: yes
+    update_cache: true
     cache_valid_time: 3600
   when:
     - ansible_distribution|lower == 'ubuntu'
@@ -20,9 +20,7 @@
 - name: Conf - Add Nomad Group
   group:
     name: "{{ nomad_group }}"
-    state: "{{ nomad_group_state }}"
-  when:
-    - nomad_manage_group | bool
+    state: "{{ nomad_user_state }}"
   tags:
     - nomad-conf-user
 
   user:
     name: "{{ nomad_user }}"
     group: "{{ nomad_group }}"
-    groups: "{{ nomad_user_groups }}"
-    state: "{{ nomad_user_state }}"
+    state: "{{ nomad_group_state }}"
     system: true
-  when:
-    - nomad_manage_user | bool
   tags:
     - nomad-conf-user
 
   tags:
     - nomad-conf
 
-- name: Conf - Custom Configuration
+- name: Conf - Consul Configuration
   template:
-    src: custom.json.j2
-    dest: "{{ nomad_config_dir }}/custom.json"
+    src: consul.hcl.j2
+    dest: "{{ nomad_config_dir }}/consul.hcl"
     owner: "{{ nomad_user }}"
     group: "{{ nomad_group }}"
     mode: 0644
-  when:
-    - nomad_config_custom is defined
   tags:
     - nomad-conf
 
     owner: "root"
     group: "root"
     mode: 0644
-#  notify:
-#    - "Restart Nomad"
+  notify:
+    - "Restart Nomad"
   tags:
     - nomad-conf
+
+- meta: flush_handlers