2 # file: roles/nomad/tasks/main.yaml
4 - name: Inst - Update Package Cache (APT)
9 - ansible_distribution|lower == 'ubuntu'
11 - nomad-inst-prerequisites
13 - name: Inst - Prerequisites
15 name: "{{ packages | flatten(levels=1) }}"
18 - nomad-inst-prerequisites
20 - name: Conf - Add Nomad Group
22 name: "{{ nomad_group }}"
23 state: "{{ nomad_group_state }}"
25 - nomad_manage_group | bool
29 - name: Conf - Add Nomad user
31 name: "{{ nomad_user }}"
32 group: "{{ nomad_group }}"
33 groups: "{{ nomad_user_groups }}"
34 state: "{{ nomad_user_state }}"
37 - nomad_manage_user | bool
41 - name: Inst - Clean Nomad
43 path: "{{ nomad_inst_dir }}/nomad"
48 - name: Inst - Download Nomad
50 url: "{{ nomad_zip_url }}"
51 dest: "{{ nomad_inst_dir }}/{{ nomad_pkg }}"
55 - name: Inst - Unarchive Nomad
57 src: "{{ nomad_inst_dir }}/{{ nomad_pkg }}"
58 dest: "{{ nomad_inst_dir }}/"
59 creates: "{{ nomad_inst_dir }}/nomad"
66 src: "{{ nomad_inst_dir }}/nomad"
67 dest: "{{ nomad_bin_dir }}"
68 owner: "{{ nomad_user }}"
69 group: "{{ nomad_group }}"
76 - name: Conf - Create Directories "{{ nomad_data_dir }}"
78 dest: "{{ nomad_data_dir }}"
80 owner: "{{ nomad_user }}"
81 group: "{{ nomad_group }}"
85 - name: Conf - Create Directories "{{ nomad_ssl_dir }}"
87 dest: "{{ nomad_ssl_dir }}"
89 owner: "{{ nomad_user }}"
90 group: "{{ nomad_group }}"
94 - name: Conf - Create Config Directory
96 dest: "{{ nomad_config_dir }}"
98 owner: "{{ nomad_user }}"
99 group: "{{ nomad_group }}"
104 - name: Conf - Base Configuration
107 dest: "{{ nomad_config_dir }}/base.hcl"
108 owner: "{{ nomad_user }}"
109 group: "{{ nomad_group }}"
114 - name: Conf - Server Configuration
117 dest: "{{ nomad_config_dir }}/server.hcl"
118 owner: "{{ nomad_user }}"
119 group: "{{ nomad_group }}"
122 - nomad_node_server | bool
126 - name: Conf - Client Configuration
129 dest: "{{ nomad_config_dir }}/client.hcl"
130 owner: "{{ nomad_user }}"
131 group: "{{ nomad_group }}"
134 - nomad_node_client | bool
138 - name: Conf - TLS Configuration
141 dest: "{{ nomad_config_dir }}/tls.hcl"
142 owner: "{{ nomad_user }}"
143 group: "{{ nomad_group }}"
148 - name: Conf - Telemetry Configuration
150 src: telemetry.hcl.j2
151 dest: "{{ nomad_config_dir }}/telemetry.hcl"
152 owner: "{{ nomad_user }}"
153 group: "{{ nomad_group }}"
158 - name: Conf - Custom Configuration
161 dest: "{{ nomad_config_dir }}/custom.json"
162 owner: "{{ nomad_user }}"
163 group: "{{ nomad_group }}"
166 - nomad_config_custom is defined
170 - name: Conf - Copy Certificates And Keys
172 content: "{{ item.src }}"
173 dest: "{{ item.dest }}"
174 owner: "{{ nomad_user }}"
175 group: "{{ nomad_group }}"
178 loop: "{{ nomad_certificates | flatten(levels=1) }}"
182 - name: Conf - System.d Script
184 src: "nomad_systemd.service.j2"
185 dest: "/lib/systemd/system/nomad.service"