feat(nomad): remove cni installation option from nomad role, as it has been moved to its own role
All checks were successful
development / Check commit compliance (push) Successful in 6s
All checks were successful
development / Check commit compliance (push) Successful in 6s
This commit is contained in:
parent
69fa4aecde
commit
bc2aa9353b
@ -8,10 +8,6 @@ nomad_data_dir: "/opt/nomad"
|
|||||||
nomad_certs_dir: "{{ nomad_config_dir }}/tls"
|
nomad_certs_dir: "{{ nomad_config_dir }}/tls"
|
||||||
nomad_logs_dir: "/var/log/nomad"
|
nomad_logs_dir: "/var/log/nomad"
|
||||||
|
|
||||||
nomad_cni_plugins_install: true
|
|
||||||
nomad_cni_plugins_version: latest
|
|
||||||
nomad_cni_plugins_install_path: /opt/cni/bin
|
|
||||||
|
|
||||||
nomad_extra_files: false
|
nomad_extra_files: false
|
||||||
nomad_extra_files_list: []
|
nomad_extra_files_list: []
|
||||||
|
|
||||||
@ -91,7 +87,7 @@ nomad_enable_client: false
|
|||||||
nomad_client_configuration:
|
nomad_client_configuration:
|
||||||
enabled: "{{ nomad_enable_client }}"
|
enabled: "{{ nomad_enable_client }}"
|
||||||
state_dir: "{{ nomad_data_dir }}/client"
|
state_dir: "{{ nomad_data_dir }}/client"
|
||||||
cni_path: "{{ nomad_cni_plugins_install_path }}" # "/opt/cni/bin"
|
cni_path: "/opt/cni/bin"
|
||||||
bridge_network_name: nomad
|
bridge_network_name: nomad
|
||||||
bridge_network_subnet: "172.26.64.0/20"
|
bridge_network_subnet: "172.26.64.0/20"
|
||||||
|
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
---
|
|
||||||
# task/cni_install file for hashicorp_nomad
|
|
||||||
- name: "Nomad | Get release for cni_plugins:{{ nomad_cni_plugins_version }}"
|
|
||||||
vars:
|
|
||||||
_cni_plugins_url_ext: "{% if nomad_cni_plugins_version == 'latest'%}releases{% else %}releases/tags{% endif %}"
|
|
||||||
ansible.builtin.uri:
|
|
||||||
url: "{{ nomad_github_api }}/{{ nomad_cni_github_project }}/{{ _cni_plugins_url_ext }}/{{ nomad_cni_plugins_version }}"
|
|
||||||
return_content: true
|
|
||||||
register: _cni_plugins_new_release
|
|
||||||
|
|
||||||
- name: "Nomad | Check if cni plugin is already installed"
|
|
||||||
ansible.builtin.stat:
|
|
||||||
path: "{{ nomad_cni_plugins_install_path }}/version"
|
|
||||||
changed_when: false
|
|
||||||
check_mode: false
|
|
||||||
register: _cni_plugins_is_installed
|
|
||||||
|
|
||||||
- name: "Nomad | Check current cni plugin version"
|
|
||||||
ansible.builtin.command: "cat {{ nomad_cni_plugins_install_path }}/version"
|
|
||||||
changed_when: false
|
|
||||||
check_mode: false
|
|
||||||
register: _cni_plugins_old_release
|
|
||||||
when: _cni_plugins_is_installed.stat.exists
|
|
||||||
|
|
||||||
- name: "Nomad | Set facts for wanted cni plugins release"
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
nomad_cni_plugins_wanted_version: "{{ _cni_plugins_new_release.json['tag_name']|regex_replace('v', '') }}"
|
|
||||||
when: _cni_plugins_new_release.json is defined
|
|
||||||
and (_cni_plugins_new_release.json | length > 0)
|
|
||||||
|
|
||||||
- name: "Nomad | Set facts for current cni plugins release"
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
nomad_cni_plugins_current_version: "{{ _cni_plugins_old_release.stdout | regex_replace('v', '') }}"
|
|
||||||
when: _cni_plugins_old_release.stdout is defined
|
|
||||||
and (_cni_plugins_old_release.stdout | length > 0)
|
|
||||||
|
|
||||||
- name: "Nomad | Create cni directory"
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ nomad_cni_plugins_install_path }}"
|
|
||||||
state: directory
|
|
||||||
owner: "{{ nomad_user }}"
|
|
||||||
group: "{{ nomad_group }}"
|
|
||||||
mode: "0755"
|
|
||||||
|
|
||||||
- name: "Nomad | Install cni plugins"
|
|
||||||
when: nomad_cni_plugins_current_version is not defined
|
|
||||||
or nomad_cni_plugins_wanted_version not in nomad_cni_plugins_current_version
|
|
||||||
block:
|
|
||||||
- name: "Nomad | Install cni plugins version:{{ nomad_cni_plugins_version }}"
|
|
||||||
ansible.builtin.get_url:
|
|
||||||
url: "{{ nomad_github_url }}/{{ nomad_cni_github_project }}/releases/download/v{{ nomad_cni_plugins_wanted_version }}/cni-plugins-linux-{{ nomad_architecture }}-v{{ nomad_cni_plugins_wanted_version }}.tgz"
|
|
||||||
dest: "/tmp/cni_plugin.tgz"
|
|
||||||
mode: "0644"
|
|
||||||
register: _cni_plugins_download_archive
|
|
||||||
until: _cni_plugins_download_archive is succeeded
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
check_mode: false
|
|
||||||
|
|
||||||
- name: "Nomad | Unpack cni plugins"
|
|
||||||
ansible.builtin.unarchive:
|
|
||||||
src: "/tmp/cni_plugin.tgz"
|
|
||||||
dest: "{{ nomad_cni_plugins_install_path }}"
|
|
||||||
owner: "{{ nomad_user }}"
|
|
||||||
group: "{{ nomad_group }}"
|
|
||||||
mode: "0755"
|
|
||||||
remote_src: true
|
|
||||||
|
|
||||||
- name: "Nomad | Remove temporary archive"
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "/tmp/cni_plugin.tgz"
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
- name: "Nomad | Update version file"
|
|
||||||
ansible.builtin.copy:
|
|
||||||
content: "{{ nomad_cni_plugins_wanted_version }}"
|
|
||||||
dest: "{{ nomad_cni_plugins_install_path }}/version"
|
|
||||||
mode: "0600"
|
|
@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
# task/install file for nomad
|
||||||
- name: "Nomad | Get latest release of nomad"
|
- name: "Nomad | Get latest release of nomad"
|
||||||
when: nomad_version == 'latest'
|
when: nomad_version == 'latest'
|
||||||
block:
|
block:
|
||||||
|
@ -14,10 +14,6 @@
|
|||||||
- name: "Nomad | Import install.yml"
|
- name: "Nomad | Import install.yml"
|
||||||
ansible.builtin.include_tasks: install.yml
|
ansible.builtin.include_tasks: install.yml
|
||||||
|
|
||||||
- name: "Nomad | Import cni_install.yml"
|
|
||||||
ansible.builtin.include_tasks: cni_install.yml
|
|
||||||
when: nomad_cni_plugins_install
|
|
||||||
|
|
||||||
- name: "Nomad | Import configure.yml"
|
- name: "Nomad | Import configure.yml"
|
||||||
ansible.builtin.include_tasks: configure.yml
|
ansible.builtin.include_tasks: configure.yml
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user