diff --git a/all-in-one.sh b/all-in-one.sh index 900bbe47c..6d7734dd2 100755 --- a/all-in-one.sh +++ b/all-in-one.sh @@ -42,9 +42,9 @@ print_header 'Start (all-in-one.sh)' if is_fedora; then print_header 'Setup (RedHat based)' - sudo yum -y remove facter puppet rdo-release - sudo yum -y install libxml2-devel libxslt-devel ruby-devel rubygems wget - sudo yum -y groupinstall "Development Tools" + sudo -E $YUM -y remove facter puppet rdo-release + sudo -E $YUM -y install libxml2-devel libxslt-devel ruby-devel rubygems wget + sudo -E $YUM -y groupinstall "Development Tools" DASHBOARD="dashboard" elif uses_debs; then print_header 'Setup (Debian based)' diff --git a/copy_logs.sh b/copy_logs.sh index bbfb0ab41..52efc7618 100755 --- a/copy_logs.sh +++ b/copy_logs.sh @@ -206,7 +206,7 @@ if [ `command -v dpkg` ]; then fi if [ `command -v rpm` ]; then rpm -qa |sort > $LOG_DIR/rpm-qa.txt - yum repolist -v > $LOG_DIR/repolist.txt + $YUM repolist -v > $LOG_DIR/repolist.txt fi if [ `command -v gem` ]; then diff --git a/functions b/functions index 0f4607405..86d3d07b4 100644 --- a/functions +++ b/functions @@ -107,6 +107,12 @@ uses_debs() { type "apt-get" 2>/dev/null } +if type "dnf" 2>/dev/null;then + export YUM=dnf +else + export YUM=yum +fi + print_header() { if [ -n "$(set | grep xtrace)" ]; then set +x @@ -161,7 +167,7 @@ enabled=1 gpgcheck=1 EOF" fi - $SUDO yum install -y ${PUPPET_PKG} + $SUDO $YUM install -y ${PUPPET_PKG} fi } diff --git a/manifests/mysql.pp b/manifests/mysql.pp index 8d46ed799..150c4fafd 100644 --- a/manifests/mysql.pp +++ b/manifests/mysql.pp @@ -3,7 +3,8 @@ class openstack_integration::mysql { class { '::mysql::server': } # FIXME (amoralej) Required until a new release of mariadb-libs is released by RDO - if $::osfamily == 'RedHat' { + # Fedora do not have mariadb-libs, so changing only for CentOS + if $::operatingsystem == 'CentOS' { package { 'mariadb-libs': ensure => 'latest' } diff --git a/playbooks/prepare-node-common.yaml b/playbooks/prepare-node-common.yaml index 0697df955..bdfee4ded 100644 --- a/playbooks/prepare-node-common.yaml +++ b/playbooks/prepare-node-common.yaml @@ -5,22 +5,60 @@ path: "{{ ansible_user_dir }}/workspace" state: directory - - name: Clean-up system state (RedHat) + - 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: Clean-up system state (non Fedora) yum: name: "{{ item }}" state: absent become: true - when: ansible_os_family == 'RedHat' + when: + - ansible_os_family == 'RedHat' + - ansible_distribution != "Fedora" with_items: - rdo-release - centos-release-openstack-* - centos-release-ceph-* - - name: Install Ruby dependencies (RedHat) + - 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' + when: + - ansible_os_family == 'RedHat' + - ansible_distribution != "Fedora" with_items: - "@Development tools" - libxml2-devel @@ -60,9 +98,14 @@ cmd: | set -e set -x - if [ -f /usr/bin/yum ]; then - yum install -y https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm - yum install -y puppet-agent + 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/puppetlabs-release-pc1-el-7.noarch.rpm + $YUM install -y puppet-agent elif [ -f /usr/bin/apt-get ]; then wget https://apt.puppetlabs.com/puppetlabs-release-pc1-{{ ansible_distribution_release }}.deb -O /tmp/puppet.deb dpkg -i /tmp/puppet.deb diff --git a/playbooks/run-beaker-tests.yaml b/playbooks/run-beaker-tests.yaml index bdfda741b..685ee9238 100644 --- a/playbooks/run-beaker-tests.yaml +++ b/playbooks/run-beaker-tests.yaml @@ -13,7 +13,7 @@ ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P "" sudo mkdir -p /root/.ssh cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys - if [ -f /usr/bin/yum ]; then + if [[ -f /usr/bin/yum || -f /usr/bin/dnf ]]; then sudo systemctl reload sshd elif [ -f /usr/bin/apt-get ]; then sudo service ssh restart diff --git a/playbooks/run-libraries-beaker-tests.yaml b/playbooks/run-libraries-beaker-tests.yaml index 2f76df850..d38382b3e 100644 --- a/playbooks/run-libraries-beaker-tests.yaml +++ b/playbooks/run-libraries-beaker-tests.yaml @@ -12,7 +12,7 @@ ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P "" sudo mkdir -p /root/.ssh cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys - if [ -f /usr/bin/yum ]; then + if [[ -f /usr/bin/yum || -f /usr/bin/dnf ]]; then sudo systemctl reload sshd elif [ -f /usr/bin/apt-get ]; then sudo service ssh restart diff --git a/run_tests.sh b/run_tests.sh index 0583ac22a..bd2034ebc 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -162,7 +162,7 @@ fi if uses_debs; then $SUDO apt-get install -y dstat ebtables iotop sysstat elif is_fedora; then - $SUDO yum install -y dstat setools setroubleshoot audit iotop sysstat + $SUDO $YUM install -y dstat setools setroubleshoot audit iotop sysstat $SUDO service auditd start # SElinux in permissive mode so later we can catch alerts $SUDO selinuxenabled && $SUDO setenforce 0 @@ -205,7 +205,7 @@ if [ "${MANAGE_REPOS}" = true ]; then fi if is_fedora; then print_header 'Updating packages' - $SUDO yum update -y + $SUDO $YUM update -y if [ $? -ne 0 ]; then print_header 'Error updating packages' exit 1