diff --git a/roles/podman/tasks/variables.yml b/roles/podman/tasks/variables.yml index b857d34..8ab209e 100644 --- a/roles/podman/tasks/variables.yml +++ b/roles/podman/tasks/variables.yml @@ -7,4 +7,4 @@ - name: Define podman_packages ansible.builtin.set_fact: podman_packages: "{{ __podman_packages | list }}" - when: podman_packages is not defined + when: podman_packages is not defined diff --git a/roles/setup/tasks/main.yml b/roles/setup/tasks/main.yml index 348f108..1be5f80 100644 --- a/roles/setup/tasks/main.yml +++ b/roles/setup/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: Run preflight - ansible.builtin.include_tasks: preflight.yml + ansible.builtin.include_tasks: preflight.yml # Variable configuration. - name: Include variables @@ -15,7 +15,7 @@ ansible.builtin.set_fact: additional_python_packages: "{{ additional_python_packages + ['receptorctl'] }}" when: - - receptor_install_method in ['release', 'local'] + - receptor_install_method in ['release', 'update-release', 'local','update-local'] - "'receptorctl' not in additional_python_packages" - name: Install python packages @@ -24,11 +24,11 @@ - name: Receptor install local ansible.builtin.include_tasks: setup-local.yml - when: receptor_install_method == 'local' + when: receptor_install_method in ['local', 'update-local'] - name: Receptor install release ansible.builtin.include_tasks: setup-release.yml - when: receptor_install_method == 'release' + when: receptor_install_method in ['release', 'update-release'] - name: Check if receptor was installed correctly ansible.builtin.command: "receptor --version" @@ -43,28 +43,31 @@ fail_msg: "Receptor not installed correctly. Please check the installation or reinstall it with local_receptor: true" success_msg: "Receptor installed correctly" -- name: Configure receptor socket - ansible.builtin.include_tasks: configure.yml +- name: Configuration tasks during fisrt installation + when: "'update' not in receptor_install_method" + block: + - name: Configure receptor socket + ansible.builtin.include_tasks: configure.yml -- name: TLS files - ansible.builtin.include_tasks: tls.yml - when: receptor_tls + - name: TLS files + ansible.builtin.include_tasks: tls.yml + when: receptor_tls -- name: Work signing - ansible.builtin.include_tasks: worksign.yml - when: receptor_sign or receptor_verify + - name: Work signing + ansible.builtin.include_tasks: worksign.yml + when: receptor_sign or receptor_verify -- name: Generate receptor config - ansible.builtin.include_tasks: generate_config.yml + - name: Generate receptor config + ansible.builtin.include_tasks: generate_config.yml - name: Setup systemd ansible.builtin.include_tasks: setup-service.yml - when: receptor_install_method in ['release', 'local'] + when: receptor_install_method in ['release', 'local', 'update-release', 'local','update-local'] - name: Start Receptor service ansible.builtin.systemd: name: "{{ receptor_service_name }}" - state: started + state: 'started' daemon_reload: true enabled: true register: _started diff --git a/roles/setup/tasks/preflight.yml b/roles/setup/tasks/preflight.yml index 24e10a1..5fee813 100644 --- a/roles/setup/tasks/preflight.yml +++ b/roles/setup/tasks/preflight.yml @@ -2,4 +2,4 @@ - name: Check local binary file is set ansible.builtin.assert: that: receptor_local_bin_file | length - when: receptor_install_method == 'local' + when: receptor_install_method in ['local', 'update-local'] diff --git a/roles/setup/tasks/python_packages.yml b/roles/setup/tasks/python_packages.yml index a3fc6dd..eb52e55 100644 --- a/roles/setup/tasks/python_packages.yml +++ b/roles/setup/tasks/python_packages.yml @@ -18,6 +18,7 @@ - name: Install additional python packages ansible.builtin.pip: name: "{{ additional_python_packages | default([]) }}" + state: "{{ 'latest' if 'update' in receptor_install_method else 'present' }}" executable: "{{ pip_executable }}" - name: Symlink receptorctl to /usr/bin diff --git a/roles/setup/tasks/setup-Debian.yml b/roles/setup/tasks/setup-Debian.yml index fd39986..25b72a0 100644 --- a/roles/setup/tasks/setup-Debian.yml +++ b/roles/setup/tasks/setup-Debian.yml @@ -2,4 +2,4 @@ - name: Install dependencies specific to the node type ansible.builtin.apt: name: "{{ additional_system_packages | default([]) }}" - state: present + state: "{{ 'latest' if 'update' in receptor_install_method else 'present' }}" diff --git a/roles/setup/tasks/setup-RedHat.yml b/roles/setup/tasks/setup-RedHat.yml index 441ed55..41463b0 100644 --- a/roles/setup/tasks/setup-RedHat.yml +++ b/roles/setup/tasks/setup-RedHat.yml @@ -2,7 +2,7 @@ - name: Install receptor packages ansible.builtin.dnf: name: "{{ receptor_packages }}" - state: present + state: "{{ 'latest' if 'update' in receptor_install_method else 'present' }}" when: - receptor_install_method == 'package' - receptor_packages @@ -37,4 +37,4 @@ - name: Install dependencies specific to the node type ansible.builtin.dnf: name: "{{ additional_system_packages | default([]) }}" - state: present + state: "{{ 'latest' if 'update' in receptor_install_method else 'present' }}"