30 lines
1.1 KiB
YAML

- block:
- include_tasks: 01_core.yml
- set_fact:
run_once_pkgmgr_install: true
when: run_once_pkgmgr_install is not defined
- name: update {{ package_name }}
ansible.builtin.shell: |
source ~/.venvs/pkgmgr/bin/activate
pkgmgr update {{ package_name }} --dependencies --clone-mode https
args:
executable: /bin/bash
notify: "{{ package_notify | default(omit,true) }}"
register: pkgmgr_update_result
# Mark changed only if it's not "already up to date" and not "no command defined..."
changed_when: >
('already up to date' not in ((pkgmgr_update_result.stdout | default('') | lower)
~ ' ' ~ (pkgmgr_update_result.stderr | default('') | lower)))
and
('no command defined' not in ((pkgmgr_update_result.stdout | default('') | lower)
~ ' ' ~ (pkgmgr_update_result.stderr | default('') | lower)))
# Fail only on real errors; allow the "no command defined..." case
failed_when: >
(pkgmgr_update_result.rc != 0)
and
('no command defined' not in ((pkgmgr_update_result.stdout | default('') | lower)
~ ' ' ~ (pkgmgr_update_result.stderr | default('') | lower)))