diff --git a/roles/nomad/defaults/main.yml b/roles/nomad/defaults/main.yml index e5c2419..fd66ceb 100644 --- a/roles/nomad/defaults/main.yml +++ b/roles/nomad/defaults/main.yml @@ -8,10 +8,6 @@ nomad_data_dir: "/opt/nomad" nomad_certs_dir: "{{ nomad_config_dir }}/tls" 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_list: [] @@ -91,7 +87,7 @@ nomad_enable_client: false nomad_client_configuration: enabled: "{{ nomad_enable_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_subnet: "172.26.64.0/20" diff --git a/roles/nomad/tasks/cni_install.yml b/roles/nomad/tasks/cni_install.yml deleted file mode 100644 index cd11e26..0000000 --- a/roles/nomad/tasks/cni_install.yml +++ /dev/null @@ -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" diff --git a/roles/nomad/tasks/install.yml b/roles/nomad/tasks/install.yml index 3ac3a5a..200bcb4 100644 --- a/roles/nomad/tasks/install.yml +++ b/roles/nomad/tasks/install.yml @@ -1,4 +1,5 @@ --- +# task/install file for nomad - name: "Nomad | Get latest release of nomad" when: nomad_version == 'latest' block: diff --git a/roles/nomad/tasks/main.yml b/roles/nomad/tasks/main.yml index a3ca21c..4575a15 100644 --- a/roles/nomad/tasks/main.yml +++ b/roles/nomad/tasks/main.yml @@ -14,10 +14,6 @@ - name: "Nomad | Import 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" ansible.builtin.include_tasks: configure.yml