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 if is_fedora; then
print_header 'Setup (RedHat based)' print_header 'Setup (RedHat based)'
sudo yum -y remove facter puppet rdo-release sudo -E $YUM -y remove facter puppet rdo-release
sudo yum -y install libxml2-devel libxslt-devel ruby-devel rubygems wget sudo -E $YUM -y install libxml2-devel libxslt-devel ruby-devel rubygems wget
sudo yum -y groupinstall "Development Tools" sudo -E $YUM -y groupinstall "Development Tools"
DASHBOARD="dashboard" DASHBOARD="dashboard"
elif uses_debs; then elif uses_debs; then
print_header 'Setup (Debian based)' print_header 'Setup (Debian based)'

View File

@ -206,7 +206,7 @@ if [ `command -v dpkg` ]; then
fi fi
if [ `command -v rpm` ]; then if [ `command -v rpm` ]; then
rpm -qa |sort > $LOG_DIR/rpm-qa.txt rpm -qa |sort > $LOG_DIR/rpm-qa.txt
yum repolist -v > $LOG_DIR/repolist.txt $YUM repolist -v > $LOG_DIR/repolist.txt
fi fi
if [ `command -v gem` ]; then if [ `command -v gem` ]; then

View File

@ -107,6 +107,12 @@ uses_debs() {
type "apt-get" 2>/dev/null type "apt-get" 2>/dev/null
} }
if type "dnf" 2>/dev/null;then
export YUM=dnf
else
export YUM=yum
fi
print_header() { print_header() {
if [ -n "$(set | grep xtrace)" ]; then if [ -n "$(set | grep xtrace)" ]; then
set +x set +x
@ -161,7 +167,7 @@ enabled=1
gpgcheck=1 gpgcheck=1
EOF" EOF"
fi fi
$SUDO yum install -y ${PUPPET_PKG} $SUDO $YUM install -y ${PUPPET_PKG}
fi fi
} }

View File

@ -3,7 +3,8 @@ class openstack_integration::mysql {
class { '::mysql::server': } class { '::mysql::server': }
# FIXME (amoralej) Required until a new release of mariadb-libs is released by RDO # 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': package { 'mariadb-libs':
ensure => 'latest' ensure => 'latest'
} }

View File

@ -5,22 +5,60 @@
path: "{{ ansible_user_dir }}/workspace" path: "{{ ansible_user_dir }}/workspace"
state: directory 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: yum:
name: "{{ item }}" name: "{{ item }}"
state: absent state: absent
become: true become: true
when: ansible_os_family == 'RedHat' when:
- ansible_os_family == 'RedHat'
- ansible_distribution != "Fedora"
with_items: with_items:
- rdo-release - rdo-release
- centos-release-openstack-* - centos-release-openstack-*
- centos-release-ceph-* - 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: yum:
name: "{{ item }}" name: "{{ item }}"
become: true become: true
when: ansible_os_family == 'RedHat' when:
- ansible_os_family == 'RedHat'
- ansible_distribution != "Fedora"
with_items: with_items:
- "@Development tools" - "@Development tools"
- libxml2-devel - libxml2-devel
@ -60,9 +98,14 @@
cmd: | cmd: |
set -e set -e
set -x set -x
if [ -f /usr/bin/yum ]; then if type "dnf" 2>/dev/null;then
yum install -y https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm export YUM=dnf
yum install -y puppet-agent 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 elif [ -f /usr/bin/apt-get ]; then
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-{{ ansible_distribution_release }}.deb -O /tmp/puppet.deb wget https://apt.puppetlabs.com/puppetlabs-release-pc1-{{ ansible_distribution_release }}.deb -O /tmp/puppet.deb
dpkg -i /tmp/puppet.deb dpkg -i /tmp/puppet.deb

View File

@ -13,7 +13,7 @@
ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P "" ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P ""
sudo mkdir -p /root/.ssh sudo mkdir -p /root/.ssh
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys 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 sudo systemctl reload sshd
elif [ -f /usr/bin/apt-get ]; then elif [ -f /usr/bin/apt-get ]; then
sudo service ssh restart sudo service ssh restart

View File

@ -12,7 +12,7 @@
ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P "" ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P ""
sudo mkdir -p /root/.ssh sudo mkdir -p /root/.ssh
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys 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 sudo systemctl reload sshd
elif [ -f /usr/bin/apt-get ]; then elif [ -f /usr/bin/apt-get ]; then
sudo service ssh restart sudo service ssh restart

View File

@ -162,7 +162,7 @@ fi
if uses_debs; then if uses_debs; then
$SUDO apt-get install -y dstat ebtables iotop sysstat $SUDO apt-get install -y dstat ebtables iotop sysstat
elif is_fedora; then 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 $SUDO service auditd start
# SElinux in permissive mode so later we can catch alerts # SElinux in permissive mode so later we can catch alerts
$SUDO selinuxenabled && $SUDO setenforce 0 $SUDO selinuxenabled && $SUDO setenforce 0
@ -205,7 +205,7 @@ if [ "${MANAGE_REPOS}" = true ]; then
fi fi
if is_fedora; then if is_fedora; then
print_header 'Updating packages' print_header 'Updating packages'
$SUDO yum update -y $SUDO $YUM update -y
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
print_header 'Error updating packages' print_header 'Error updating packages'
exit 1 exit 1