Allow running poi scenarios on Fedora

Change-Id: I409c11f31d4b82ef9a3d6ba20e2dd045156d66a9
This commit is contained in:
yatin 2018-06-13 19:07:02 +05:30
parent 11a5e5815f
commit e931cd247a
8 changed files with 67 additions and 17 deletions

View File

@ -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)'

View File

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

View File

@ -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
}

View File

@ -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'
}

View File

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

View File

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

View File

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

View File

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