diff --git a/roles/update-compose/tasks/main.yml b/roles/update-compose/tasks/main.yml index bd73a560..4a80d53a 100644 --- a/roles/update-compose/tasks/main.yml +++ b/roles/update-compose/tasks/main.yml @@ -3,49 +3,76 @@ stat: path: "{{ path_docker_compose_instances }}" register: docker_compose_directory_stat + when: + - run_once_update is not defined - name: "Update with pacman" include_role: name: update-pacman - when: ansible_distribution == 'Archlinux' + when: + - run_once_update is not defined + - ansible_distribution == 'Archlinux' - name: "Update with apt" include_role: name: update-apt - when: ansible_distribution == "Debian" + when: + - run_once_update is not defined + - ansible_distribution == "Debian" - name: "Update Docker Images" include_role: name: update-docker - when: docker_compose_directory_stat.stat.exists + when: + - run_once_update is not defined + - docker_compose_directory_stat.stat.exists - name: "Check if yay is installed" command: which yay register: yay_installed changed_when: false failed_when: false + when: + - run_once_update is not defined - name: "Update with yay" include_role: name: update-yay - when: yay_installed.rc == 0 + when: + - run_once_update is not defined + - yay_installed.rc == 0 + - name: "Check if pip is installed" command: which pip register: pip_installed changed_when: false failed_when: false + when: + - run_once_update is not defined - name: "Update with pip" include_role: name: update-pip - + when: + - run_once_update is not defined + + - name: "Check if pkgmgr command is available" command: "which pkgmgr" register: pkgmgr_available failed_when: false + when: + - run_once_update is not defined - name: "Update all repositories using pkgmgr" include_role: name: update-pkgmgr - when: pkgmgr_available.rc == 0 \ No newline at end of file + when: + - pkgmgr_available.rc == 0 + - run_once_update is not defined + +- name: run the update tasks once + set_fact: + run_once_update: true + when: run_once_update is not defined \ No newline at end of file diff --git a/roles/update-docker/tasks/main.yml b/roles/update-docker/tasks/main.yml index 41a7332c..09492748 100644 --- a/roles/update-docker/tasks/main.yml +++ b/roles/update-docker/tasks/main.yml @@ -2,21 +2,31 @@ systemd: name: sys-bkp-docker-2-loc-everything.cymais.service state: started - when: mode_backup | bool + when: + - run_once_update_docker is not defined + - mode_backup | bool - name: create {{update_docker_script}} template: src: update-docker.py.j2 dest: "{{update_docker_script}}" + when: run_once_update_docker is not defined - name: configure update-docker.cymais.service template: src: update-docker.service.j2 dest: /etc/systemd/system/update-docker.cymais.service + when: run_once_update_docker is not defined - name: "restart update-docker.cymais.service" systemd: name: update-docker.cymais.service state: restarted enabled: yes - daemon_reload: yes \ No newline at end of file + daemon_reload: yes + when: run_once_update_docker is not defined + +- name: run the update docker tasks once + set_fact: + run_once_update_docker: true + when: run_once_update_docker is not defined \ No newline at end of file diff --git a/roles/update-docker/vars/main.yml b/roles/update-docker/vars/main.yml index e4725cec..3fabb35d 100644 --- a/roles/update-docker/vars/main.yml +++ b/roles/update-docker/vars/main.yml @@ -1,2 +1,2 @@ update_docker_script: '{{path_administrator_scripts}}update-docker.py' -application_id: docker +application_id: update-docker diff --git a/roles/update-pacman/tasks/main.yml b/roles/update-pacman/tasks/main.yml index f7285d6f..8b183d9a 100644 --- a/roles/update-pacman/tasks/main.yml +++ b/roles/update-pacman/tasks/main.yml @@ -2,3 +2,9 @@ pacman: update_cache: yes upgrade: yes + when: run_once_update_pacman is not defined + +- name: run update pacman once + set_fact: + run_once_update_pacman: true + when: run_once_update_pacman is not defined \ No newline at end of file diff --git a/roles/update-pacman/vars/main.yml b/roles/update-pacman/vars/main.yml index eb42ba9c..9dd1d057 100644 --- a/roles/update-pacman/vars/main.yml +++ b/roles/update-pacman/vars/main.yml @@ -1 +1 @@ -application_id: pacman +application_id: update-pacman diff --git a/roles/update-pip/vars/main.yml b/roles/update-pip/vars/main.yml index d2ea50ed..8586b633 100644 --- a/roles/update-pip/vars/main.yml +++ b/roles/update-pip/vars/main.yml @@ -1 +1 @@ -application_id: pip +application_id: update-pip diff --git a/roles/update-pkgmgr/defaults/main.yml b/roles/update-pkgmgr/defaults/main.yml deleted file mode 100644 index 78b1ac0f..00000000 --- a/roles/update-pkgmgr/defaults/main.yml +++ /dev/null @@ -1 +0,0 @@ -pkgmgr_command: "pkgmgr" \ No newline at end of file diff --git a/roles/update-pkgmgr/vars/main.yml b/roles/update-pkgmgr/vars/main.yml index aebd3469..98ad566a 100644 --- a/roles/update-pkgmgr/vars/main.yml +++ b/roles/update-pkgmgr/vars/main.yml @@ -1 +1 @@ -application_id: pkgmgr +application_id: update-pkgmgr diff --git a/roles/update-yay/tasks/main.yml b/roles/update-yay/tasks/main.yml index 69b06d03..966c323a 100644 --- a/roles/update-yay/tasks/main.yml +++ b/roles/update-yay/tasks/main.yml @@ -3,4 +3,10 @@ kewlfft.aur.aur: upgrade: yes use: yay - aur_only: yes \ No newline at end of file + aur_only: yes + when: run_once_update_yay is not defined + +- name: run update yay once + set_fact: + run_once_update_yay: true + when: run_once_update_yay is not defined \ No newline at end of file diff --git a/roles/update-yay/vars/main.yml b/roles/update-yay/vars/main.yml index d5704207..e2d9b3ca 100644 --- a/roles/update-yay/vars/main.yml +++ b/roles/update-yay/vars/main.yml @@ -1 +1 @@ -application_id: yay +application_id: update-yay diff --git a/tasks/stages/01_constructor.yml b/tasks/stages/01_constructor.yml index a54015c7..fe968e04 100644 --- a/tasks/stages/01_constructor.yml +++ b/tasks/stages/01_constructor.yml @@ -96,6 +96,7 @@ include_role: name: user-root +# @todo change this to role based todo - name: update device include_role: name: update-compose diff --git a/tasks/stages/03_destructor.yml b/tasks/stages/03_destructor.yml index c1c65c41..c64c71e5 100644 --- a/tasks/stages/03_destructor.yml +++ b/tasks/stages/03_destructor.yml @@ -2,5 +2,6 @@ include_tasks: "./tasks/groups/{{ item }}-roles.yml" loop: - svc-opt # Load optimation services + - update # Do additional update routines @todo remove the update from the constructor and the main.py loop_control: label: "{{ item }}-roles.yml" \ No newline at end of file