Replaces many references to command: with ansible.builtin.command Signed-off-by: Ryan Lerch <rlerch@redhat.com>
41 lines
1.7 KiB
YAML
41 lines
1.7 KiB
YAML
# 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
|
|
hosts: "{{target}}"
|
|
user: root
|
|
|
|
vars:
|
|
testing: false
|
|
|
|
tasks:
|
|
|
|
- name: Yum update {{ package }} from main repo
|
|
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
|
|
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'
|