|
37 | 37 | - name: Install OS packages |
38 | 38 | ansible.builtin.include_tasks: |
39 | 39 | file: install.yml |
| 40 | + when: not nomad_install_from_repo | bool |
| 41 | + |
| 42 | +- name: Install from repo |
| 43 | + ansible.builtin.include_tasks: |
| 44 | + file: install_linux_repo.yml |
| 45 | + when: nomad_install_from_repo | bool |
40 | 46 |
|
41 | 47 | - name: Disable SELinux (RHEL) |
42 | 48 | ansible.builtin.include_tasks: |
|
95 | 101 | file: tls.yml |
96 | 102 | when: nomad_tls_enable | bool |
97 | 103 |
|
| 104 | +- name: Remove default configuration |
| 105 | + file: |
| 106 | + dest: "{{ nomad_config_dir }}/nomad.hcl" |
| 107 | + state: absent |
| 108 | + when: |
| 109 | + - nomad_allow_purge_config | bool |
| 110 | + - nomad_install_from_repo | bool |
| 111 | + notify: |
| 112 | + - restart nomad |
| 113 | + |
98 | 114 | - name: Server configuration |
99 | 115 | ansible.builtin.template: |
100 | 116 | src: server.hcl.j2 |
|
151 | 167 | notify: |
152 | 168 | - Restart nomad |
153 | 169 |
|
154 | | -- name: Remove custome configuration |
| 170 | +- name: Remove custom configuration |
155 | 171 | ansible.builtin.file: |
156 | 172 | dest: "{{ nomad_config_dir }}/custom.json" |
157 | 173 | state: absent |
|
183 | 199 | mode: "0755" |
184 | 200 | when: not ansible_service_mgr == "systemd" and ansible_os_family == "Debian" |
185 | 201 |
|
186 | | -- name: Extract systemd version |
187 | | - ansible.builtin.shell: |
188 | | - cmd: set -o pipefail && systemctl --version systemd | head -n 1 | cut -d ' ' -f2 |
189 | | - args: |
190 | | - executable: /bin/bash |
191 | | - changed_when: false |
192 | | - check_mode: false |
193 | | - register: systemd_version |
| 202 | +- block: |
| 203 | + - name: Extract systemd version |
| 204 | + ansible.builtin.shell: |
| 205 | + cmd: set -o pipefail && systemctl --version systemd | head -n 1 | cut -d ' ' -f2 |
| 206 | + args: |
| 207 | + executable: /bin/bash |
| 208 | + changed_when: false |
| 209 | + check_mode: false |
| 210 | + register: systemd_version |
| 211 | + when: |
| 212 | + - ansible_service_mgr == "systemd" |
| 213 | + - not ansible_os_family == "FreeBSD" |
| 214 | + - not ansible_os_family == "Solaris" |
| 215 | + tags: skip_ansible_lint |
| 216 | + |
| 217 | + - name: Create systemd unit |
| 218 | + ansible.builtin.template: |
| 219 | + src: "{{ nomad_systemd_template }}" |
| 220 | + dest: "{{ nomad_systemd_unit_path }}/nomad.service" |
| 221 | + owner: root |
| 222 | + group: root |
| 223 | + mode: "0644" |
| 224 | + notify: |
| 225 | + - Reload systemd daemon |
| 226 | + - Enable nomad at startup (systemd) |
| 227 | + when: ansible_service_mgr == "systemd" |
| 228 | + |
194 | 229 | when: |
195 | 230 | - ansible_service_mgr == "systemd" |
196 | | - - not ansible_os_family == "FreeBSD" |
197 | | - - not ansible_os_family == "Solaris" |
198 | | - tags: skip_ansible_lint |
199 | | - |
200 | | -- name: Create systemd unit |
201 | | - ansible.builtin.template: |
202 | | - src: "{{ nomad_systemd_template }}" |
203 | | - dest: "{{ nomad_systemd_unit_path }}/nomad.service" |
204 | | - owner: root |
205 | | - group: root |
206 | | - mode: "0644" |
207 | | - notify: |
208 | | - - Reload systemd daemon |
209 | | - - Enable nomad at startup (systemd) |
210 | | - when: ansible_service_mgr == "systemd" |
| 231 | + # Repo install includes systemd files |
| 232 | + - not nomad_install_from_repo |
211 | 233 |
|
212 | 234 | - name: Start Nomad |
213 | 235 | ansible.builtin.service: |
|
0 commit comments