puppet-openstack-integration/playbooks/prepare-node-common.yaml
Takashi Kajinami 7ea649e243 CentOS: Stop installing yum
CentOS/RHEL replaced yum by dnf and yum is no longer available by
default. We (and the other projects) updated implementations to adapt
that change so we assume we no longer need the old yum command (which
is just an alias of dnf).

Depends-on: https://review.opendev.org/884307
Change-Id: I5152d1013a603e8d230748ff956d33507675450c
2023-05-25 12:03:38 +09:00

122 lines
3.1 KiB
YAML

- hosts: all
tasks:
- name: Ensure legacy workspace directory
file:
path: "{{ ansible_user_dir }}/workspace"
state: directory
- block:
- name: Clean-up system state (CentOS/RHEL)
dnf:
name: "{{ item }}"
state: absent
become: true
ignore_errors: true
with_items:
- rdo-release
- centos-release-openstack-*
- centos-release-ceph-*
- name: Reset dnf modules (CentOS/RHEL)
shell:
cmd: |-
dnf module -y reset {{ item.key }}
become: true
with_items: "{{ dnf_modules | default({}) | dict2items }}"
- name: Enable dnf modules (CentOS/RHEL)
shell:
cmd: |-
dnf module -y enable {{ item.key }}:{{ item.value }}
become: true
with_items: "{{ dnf_modules | default({}) | dict2items }}"
- name: Install Ruby dependencies (CentOS/RHEL)
dnf:
name: "{{ item }}"
become: true
with_items:
- "@Development tools"
- libxml2-devel
- libxslt-devel
- ruby-devel
- zlib-devel
- rubygem-rexml
when:
- ansible_os_family == 'RedHat'
- block:
- name: install required packages (CentOS)
dnf:
name: "{{ item }}"
state: present
become: true
ignore_errors: true
with_items:
- python3-pip
when:
- ansible_os_family == 'RedHat'
- ansible_distribution == 'CentOS'
- 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
- python3-pip
- 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
- python3-pip
- block:
- name: Set up puppetlabs repo (CentOS/RHEL)
dnf:
name: "https://yum.puppetlabs.com/puppet{{ puppet }}-release-el-{{ ansible_distribution_major_version }}.noarch.rpm"
become: true
- name: Install puppetlabs puppet-agent (CentOS/RHEL)
dnf:
name: puppet-agent
become: true
when:
- use_puppetlabs is defined
- use_puppetlabs|bool
- ansible_os_family == 'RedHat'
- block:
- name: Set up puppetlabs repo (Ubuntu and Debian)
apt:
name: "https://apt.puppetlabs.com/puppet{{ puppet }}-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'