Files
puppet-openstack-integration/playbooks/prepare-node-common.yaml
Takashi Kajinami c5c5533268 Do not fail even if dnf cleanup fails
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.

Conflicts:
	playbooks/prepare-node-common.yaml

Change-Id: Ie0a7e6455e68b387a9d392fc1fc8c970da86cddf
(cherry picked from commit 7e40c8c875)
(cherry picked from commit 27df28829d)
2020-06-22 17:48:16 +00:00

141 lines
3.7 KiB
YAML

- hosts: all
tasks:
- name: Ensure legacy workspace directory
file:
path: "{{ ansible_user_dir }}/workspace"
state: directory
- name: Install python2-dnf(Fedora)
command: "dnf -y install python2-dnf python3-dnf yum"
become: true
when:
- ansible_os_family == 'RedHat'
- ansible_distribution == "Fedora"
- name: Remove excludes from /etc/dnf/dnf.conf (Fedora)
lineinfile:
path: /etc/dnf/dnf.conf
state: absent
regexp: '^exclude='
become: true
when:
- ansible_os_family == 'RedHat'
- ansible_distribution == "Fedora"
- name: Reinstall python3-setuptools (Fedora)
command: "dnf -y reinstall python3-setuptools"
become: true
when:
- ansible_os_family == 'RedHat'
- ansible_distribution == "Fedora"
- name: Clean-up system state (non Fedora)
yum:
name: "{{ item }}"
state: absent
become: true
ignore_errors: true
when:
- ansible_os_family == 'RedHat'
- ansible_distribution != "Fedora"
with_items:
- rdo-release
- centos-release-openstack-*
- centos-release-ceph-*
- name: Clean-up system state (Fedora)
dnf:
name: "{{ item }}"
state: absent
become: true
when:
- ansible_os_family == 'RedHat'
- ansible_distribution == "Fedora"
with_items:
- rdo-release
- centos-release-openstack-*
- centos-release-ceph-*
- name: Install Ruby dependencies (Fedora)
dnf:
name: "{{ item }}"
become: true
when:
- ansible_os_family == 'RedHat'
- ansible_distribution == "Fedora"
with_items:
- "@Development tools"
- libxml2-devel
- libxslt-devel
- ruby-devel
- zlib-devel
- name: Install Ruby dependencies (non Fedora)
yum:
name: "{{ item }}"
become: true
when:
- ansible_os_family == 'RedHat'
- ansible_distribution != "Fedora"
with_items:
- "@Development tools"
- libxml2-devel
- libxslt-devel
- ruby-devel
- zlib-devel
- 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
- name: Install puppetlabs puppet-agent
shell:
cmd: |
set -e
set -x
if type "dnf" 2>/dev/null;then
export YUM=dnf
else
export YUM=yum
fi
if [[ -f /usr/bin/yum || -f /usr/bin/dnf ]]; then
$YUM install -y https://yum.puppetlabs.com/puppet5-release-el-7.noarch.rpm
$YUM install -y puppet-agent
elif [ -f /usr/bin/apt-get ]; then
wget https://apt.puppetlabs.com/puppet5-release-{{ ansible_distribution_release }}.deb -O /tmp/puppet.deb
dpkg -i /tmp/puppet.deb
apt-get update
apt-get install puppet-agent
rm -rf /tmp/puppet.deb
fi
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'
become: true
when:
- use_puppetlabs is defined
- use_puppetlabs|bool