puppet-openstack-integration/playbooks/prepare-node-common.yaml

140 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
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