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_user_state }}"
27 - name: Conf - Add Nomad user
29 name: "{{ nomad_user }}"
30 group: "{{ nomad_group }}"
31 state: "{{ nomad_group_state }}"
36 - name: Inst - Clean Nomad
38 path: "{{ nomad_inst_dir }}/nomad"
43 - name: Inst - Download Nomad
45 url: "{{ nomad_zip_url }}"
46 dest: "{{ nomad_inst_dir }}/{{ nomad_pkg }}"
50 - name: Inst - Unarchive Nomad
52 src: "{{ nomad_inst_dir }}/{{ nomad_pkg }}"
53 dest: "{{ nomad_inst_dir }}/"
54 creates: "{{ nomad_inst_dir }}/nomad"
61 src: "{{ nomad_inst_dir }}/nomad"
62 dest: "{{ nomad_bin_dir }}"
63 owner: "{{ nomad_user }}"
64 group: "{{ nomad_group }}"
71 - name: Conf - Create Directories "{{ nomad_data_dir }}"
73 dest: "{{ nomad_data_dir }}"
75 owner: "{{ nomad_user }}"
76 group: "{{ nomad_group }}"
80 - name: Conf - Create Directories "{{ nomad_ssl_dir }}"
82 dest: "{{ nomad_ssl_dir }}"
84 owner: "{{ nomad_user }}"
85 group: "{{ nomad_group }}"
89 - name: Conf - Create Config Directory
91 dest: "{{ nomad_config_dir }}"
93 owner: "{{ nomad_user }}"
94 group: "{{ nomad_group }}"
99 - name: Conf - Base Configuration
102 dest: "{{ nomad_config_dir }}/base.hcl"
103 owner: "{{ nomad_user }}"
104 group: "{{ nomad_group }}"
109 - name: Conf - Server Configuration
112 dest: "{{ nomad_config_dir }}/server.hcl"
113 owner: "{{ nomad_user }}"
114 group: "{{ nomad_group }}"
117 - nomad_node_server | bool
121 - name: Conf - Client Configuration
124 dest: "{{ nomad_config_dir }}/client.hcl"
125 owner: "{{ nomad_user }}"
126 group: "{{ nomad_group }}"
129 - nomad_node_client | bool
133 - name: Conf - TLS Configuration
136 dest: "{{ nomad_config_dir }}/tls.hcl"
137 owner: "{{ nomad_user }}"
138 group: "{{ nomad_group }}"
143 - name: Conf - Telemetry Configuration
145 src: telemetry.hcl.j2
146 dest: "{{ nomad_config_dir }}/telemetry.hcl"
147 owner: "{{ nomad_user }}"
148 group: "{{ nomad_group }}"
153 - name: Conf - Custom Configuration
156 dest: "{{ nomad_config_dir }}/custom.json"
157 owner: "{{ nomad_user }}"
158 group: "{{ nomad_group }}"
161 - nomad_config_custom is defined
165 - name: Conf - Copy Certificates And Keys
167 content: "{{ item.src }}"
168 dest: "{{ item.dest }}"
169 owner: "{{ nomad_user }}"
170 group: "{{ nomad_group }}"
173 loop: "{{ nomad_certificates | flatten(levels=1) }}"
177 - name: Conf - System.d Script
179 src: "nomad_systemd.service.j2"
180 dest: "/lib/systemd/system/nomad.service"
189 - meta: flush_handlers