2022-08-08 11:04:34 +02:00
|
|
|
# requires --extra-vars="target='host1:host2:group etc' package='python-tahrir'"
|
2013-08-16 14:16:05 +00:00
|
|
|
#
|
2013-08-16 14:24:07 +00:00
|
|
|
# Alternatively, you could update a group of packages like
|
2022-08-08 11:04:34 +02:00
|
|
|
# --extra-vars="target='host1:host2' package='python-t*'"
|
2014-02-09 23:06:54 +00:00
|
|
|
#
|
|
|
|
# To update from testing, adjust as follow:
|
2022-08-08 11:04:34 +02:00
|
|
|
# --extra-vars="target='host1:host2' package='python-t*' testing=True"
|
2013-08-16 14:16:05 +00:00
|
|
|
|
2024-11-25 18:24:56 +10:00
|
|
|
---
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Push packages out
|
2014-08-06 07:29:49 +02:00
|
|
|
hosts: "{{target}}"
|
2013-08-16 14:16:05 +00:00
|
|
|
user: root
|
|
|
|
|
2014-06-15 19:41:11 +00:00
|
|
|
vars:
|
2024-11-25 18:24:56 +10:00
|
|
|
testing: false
|
2014-06-15 19:41:11 +00:00
|
|
|
|
2013-08-16 14:16:05 +00:00
|
|
|
tasks:
|
2013-08-16 14:30:31 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Yum update {{ package }} from main repo
|
2015-10-05 14:25:05 +00:00
|
|
|
yum: name="{{ package }}" state=latest update_cache=yes
|
2019-09-19 19:27:25 +00:00
|
|
|
when: not testing and ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat'
|
2014-08-06 08:19:11 +00:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Yum update {{ package }} from testing repo
|
2017-09-05 11:59:08 +02:00
|
|
|
yum: name="{{ package }}" state=latest enablerepo=infrastructure-tags-stg update_cache=yes
|
2019-09-19 19:27:25 +00:00
|
|
|
when: testing and ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat'
|
2015-11-17 15:31:51 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Dnf clean all (since we can't do it when updating)
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: dnf clean all
|
2019-09-19 19:27:25 +00:00
|
|
|
when: not testing and ansible_distribution_major_version|int > 21 and ansible_distribution == 'Fedora'
|
2015-11-19 10:12:49 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Dnf update {{ package }} from main repo
|
2015-11-19 10:05:52 +01:00
|
|
|
dnf: name="{{ package }}" state=latest
|
2019-09-19 19:27:25 +00:00
|
|
|
when: not testing and ansible_distribution_major_version|int > 21 and ansible_distribution == 'Fedora'
|
2015-11-17 15:31:51 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Dnf clean all (since we can't do it when updating)
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: dnf clean all --enablerepo=infrastructure-tags-stg
|
2019-09-19 19:27:25 +00:00
|
|
|
when: testing and ansible_distribution_major_version|int > 21 and ansible_distribution == 'Fedora'
|
2015-11-19 10:12:49 +01:00
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Dnf update {{ package }} from testing repo
|
2017-09-05 11:59:08 +02:00
|
|
|
dnf: name="{{ package }}" state=latest enablerepo=infrastructure-tags-stg
|
2019-09-19 19:27:25 +00:00
|
|
|
when: testing and ansible_distribution_major_version|int > 21 and ansible_distribution == 'Fedora'
|