ansible/playbooks/manual/update-packages.yml

42 lines
1.7 KiB
YAML
Raw Normal View History

# requires --extra-vars="target='host1:host2:group etc' package='python-tahrir'"
#
# Alternatively, you could update a group of packages like
# --extra-vars="target='host1:host2' package='python-t*'"
#
# To update from testing, adjust as follow:
# --extra-vars="target='host1:host2' package='python-t*' testing=True"
---
- name: Push packages out
2014-08-06 07:29:49 +02:00
hosts: "{{target}}"
user: root
vars:
testing: false
tasks:
- name: Yum update {{ package }} from main repo
2015-10-05 14:25:05 +00:00
yum: name="{{ package }}" state=latest update_cache=yes
when: not testing and ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat'
- name: Yum update {{ package }} from testing repo
yum: name="{{ package }}" state=latest enablerepo=infrastructure-tags-stg update_cache=yes
when: testing and ansible_distribution_major_version|int < 8 and ansible_distribution == 'RedHat'
- name: Dnf clean all (since we can't do it when updating)
ansible.builtin.command: dnf clean all
when: not testing and ansible_distribution_major_version|int > 21 and ansible_distribution == 'Fedora'
- name: Dnf update {{ package }} from main repo
2015-11-19 10:05:52 +01:00
dnf: name="{{ package }}" state=latest
when: not testing and ansible_distribution_major_version|int > 21 and ansible_distribution == 'Fedora'
- name: Dnf clean all (since we can't do it when updating)
ansible.builtin.command: dnf clean all --enablerepo=infrastructure-tags-stg
when: testing and ansible_distribution_major_version|int > 21 and ansible_distribution == 'Fedora'
- name: Dnf update {{ package }} from testing repo
dnf: name="{{ package }}" state=latest enablerepo=infrastructure-tags-stg
when: testing and ansible_distribution_major_version|int > 21 and ansible_distribution == 'Fedora'