ansible/playbooks/manual/update-packages.yml

34 lines
1.1 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 < 22
- name: yum update {{ package }} from testing repo
2015-10-05 14:25:05 +00:00
yum: name="{{ package }}" state=latest enablerepo=infrastructure-testing update_cache=yes
when: testing and ansible_distribution_major_version|int < 22
2015-11-19 10:08:15 +01:00
- 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 > 22
2015-11-19 10:08:15 +01:00
- name: dnf update {{ package }} from testing repo
2015-11-19 10:05:52 +01:00
dnf: name="{{ package }}" state=latest enablerepo=infrastructure-testing
when: testing and ansible_distribution_major_version|int > 22