7e40c8c875
Since ansible 2.8, dnf module fails if repository name contains '*' and no repogitory which matches the expression detected. This patch makes current playbook avoid errors during dnf cleanup task, so that the tasks can pass even if there is no dnf repositories configured. Change-Id: Ie0a7e6455e68b387a9d392fc1fc8c970da86cddf
164 lines
4.4 KiB
YAML
164 lines
4.4 KiB
YAML
- hosts: all
|
|
tasks:
|
|
- name: Ensure legacy workspace directory
|
|
file:
|
|
path: "{{ ansible_user_dir }}/workspace"
|
|
state: directory
|
|
|
|
- block:
|
|
- name: Install python2-dnf(Fedora)
|
|
command: "dnf -y install python2-dnf python3-dnf yum"
|
|
become: true
|
|
|
|
- name: Remove excludes from /etc/dnf/dnf.conf (Fedora)
|
|
lineinfile:
|
|
path: /etc/dnf/dnf.conf
|
|
state: absent
|
|
regexp: '^exclude='
|
|
become: true
|
|
|
|
- name: Reinstall python3-setuptools (Fedora)
|
|
command: "dnf -y reinstall python3-setuptools"
|
|
become: true
|
|
|
|
when:
|
|
- ansible_os_family == 'RedHat'
|
|
- ansible_distribution == "Fedora"
|
|
|
|
- block:
|
|
- name: Clean-up system state (CentOS/RHEL<=7)
|
|
yum:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
become: true
|
|
with_items:
|
|
- rdo-release
|
|
- centos-release-openstack-*
|
|
- centos-release-ceph-*
|
|
|
|
- name: Install Ruby dependencies (CentOS/RHEL<=7)
|
|
yum:
|
|
name: "{{ item }}"
|
|
become: true
|
|
with_items:
|
|
- "@Development tools"
|
|
- libxml2-devel
|
|
- libxslt-devel
|
|
- ruby-devel
|
|
- zlib-devel
|
|
|
|
when:
|
|
- ansible_os_family == 'RedHat'
|
|
- ansible_distribution != "Fedora"
|
|
- ansible_distribution_major_version <= "7"
|
|
|
|
- block:
|
|
- name: Clean-up system state (Fedora or CentOS/RHEL>=8)
|
|
dnf:
|
|
name: "{{ item }}"
|
|
state: absent
|
|
become: true
|
|
ignore_errors: true
|
|
with_items:
|
|
- rdo-release
|
|
- centos-release-openstack-*
|
|
- centos-release-ceph-*
|
|
|
|
- name: Install Ruby dependencies (Fedora or CentOS/RHEL>=8)
|
|
dnf:
|
|
name: "{{ item }}"
|
|
become: true
|
|
with_items:
|
|
- "@Development tools"
|
|
- libxml2-devel
|
|
- libxslt-devel
|
|
- ruby-devel
|
|
- zlib-devel
|
|
|
|
- name: Install yum (Fedora or CentOS/RHEL>=8)
|
|
dnf:
|
|
name: yum
|
|
become: true
|
|
|
|
when:
|
|
- ansible_os_family == 'RedHat'
|
|
- ansible_distribution == "Fedora" or ansible_distribution_major_version >= "8"
|
|
|
|
- name: Install Ruby dependencies (Ubuntu)
|
|
apt:
|
|
name: "{{ item }}"
|
|
become: true
|
|
when:
|
|
- ansible_os_family == 'Debian'
|
|
- ansible_distribution == "Ubuntu"
|
|
with_items:
|
|
- libxml2-dev
|
|
- libxslt-dev
|
|
- ruby-dev
|
|
- zlib1g-dev
|
|
|
|
- name: Install Ruby dependencies (Debian)
|
|
apt:
|
|
name: "{{ item }}"
|
|
become: true
|
|
when:
|
|
- ansible_os_family == 'Debian'
|
|
- ansible_distribution == "Debian"
|
|
with_items:
|
|
- libicu-dev
|
|
- libxml2-dev
|
|
- libxslt1-dev
|
|
- ruby-dev
|
|
- zlib1g-dev
|
|
|
|
- block:
|
|
- name: Set up puppetlabs repo (Fedora or CentOS/RHEL>=8)
|
|
dnf:
|
|
name: "https://yum.puppetlabs.com/puppet5-release-fedora-{{ ansible_distribution_major_version }}.noarch.rpm"
|
|
become: true
|
|
|
|
- name: Install puppetlabs puppet-agent (Fedora or CentOS/RHEL>=8)
|
|
dnf:
|
|
name: puppet-agent
|
|
become: true
|
|
|
|
when:
|
|
- use_puppetlabs is defined
|
|
- use_puppetlabs|bool
|
|
- ansible_os_family == 'RedHat'
|
|
- ansible_distribution == "Fedora" or ansible_distribution_major_version >= "8"
|
|
|
|
- block:
|
|
- name: Set up puppetlabs repo (CentOS/RHEL<=7)
|
|
yum:
|
|
name: "https://yum.puppetlabs.com/puppet5-release-el-{{ ansible_distribution_major_version }}.noarch.rpm"
|
|
become: true
|
|
|
|
- name: Install puppetlabs puppet-agent (CentOS/RHEL<=7)
|
|
yum:
|
|
name: puppet-agent
|
|
become: true
|
|
|
|
when:
|
|
- use_puppetlabs is defined
|
|
- use_puppetlabs|bool
|
|
- ansible_os_family == 'RedHat'
|
|
- ansible_distribution != "Fedora"
|
|
- ansible_distribution_major_version <= "7"
|
|
|
|
- block:
|
|
- name: Set up puppetlabs repo (Ubuntu and Debian)
|
|
apt:
|
|
name: "https://apt.puppetlabs.com/puppet5-release-{{ ansible_distribution_release }}.deb"
|
|
become: true
|
|
|
|
- name: Install puppetlabs puppet-agent (Ubuntu and Debian)
|
|
apt:
|
|
name: puppet-agent
|
|
become: true
|
|
|
|
when:
|
|
- use_puppetlabs is defined
|
|
- use_puppetlabs|bool
|
|
- ansible_os_family == 'Debian'
|