]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ansible: Update libvirt slave playbooks to support EL8 1507/head
authorDavid Galloway <dgallowa@redhat.com>
Tue, 25 Feb 2020 00:03:30 +0000 (19:03 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Tue, 25 Feb 2020 14:55:10 +0000 (09:55 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
ansible/examples/slave_libvirt.yml
ansible/examples/slave_libvirt_static.yml

index 4d800926e73cfa7633c62f5d4882189056b087a4..70530bfde8cf5844acdd131fc3fd12f37dc05dfd 100644 (file)
@@ -1,5 +1,4 @@
 ---
-# This playbook needs to be updated for EL8 compatibility
 
 - hosts: all
   become: true
         state: latest
       when: ansible_os_family == "RedHat"
 
-    - name: disable epel for now
-      lineinfile:
-        path: "/etc/yum.repos.d/epel.repo"
-        regexp: '^enabled=.*'
-        line: 'enabled=0'
-      when: ansible_os_family == "RedHat"
-
     # Run the equivalent of "apt-get update" as a separate step
     - apt:
         update_cache: yes
       with_items:
         - git
         - gcc
-        - python-devel
         - libffi-devel
         - java-1.8.0-openjdk-devel
         - qemu-kvm
         - vagrant
         - wget
         - curl
-        - python-virtualenv
         - openssl-devel
         - redhat-lsb-core
         - iproute
         - mock
       when: ansible_os_family == "RedHat"
 
-    - name: install packages from epel
+    - name: install packages from epel (<=7)
       yum:
         name: "{{ item }}"
         state: present
       with_items:
         - jq
         - python-pip
-      when: ansible_os_family == "RedHat"
+        - python-devel
+        - python-virtualenv
+      when:
+        - ansible_os_family == "RedHat"
+        - ansible_distribution_major_version|int <= 7
+
+    - name: install packages from epel (>=8)
+      dnf:
+        name: "{{ item }}"
+        state: present
+        enablerepo: epel
+        update_cache: yes
+      with_items:
+        - jq
+        - python3-pip
+        - python3-devel
+        - python3-virtualenv
+      when:
+        - ansible_os_family == "RedHat"
+        - ansible_distribution_major_version|int >= 8
 
     - set_fact:
         jenkins_group: 'libvirtd'
         state: directory
         owner: "{{ jenkins_user }}"
 
-    - name: install the vagrant-libvirt plugin
+    - name: install the vagrant-libvirt plugin (non-RHEL8)
       shell: vagrant plugin install vagrant-libvirt
       become: yes
       become_user: "{{ jenkins_user }}"
+      when: not (ansible_os_family == "RedHat" and ansible_distribution_major_version == "8")
+
+    - name: install the vagrant-libvirt plugin (RHEL8)
+      command: vagrant plugin install vagrant-libvirt
+      environment:
+        CONFIGURE_ARGS: 'with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib64'
+      when:
+        - ansible_os_family == "RedHat"
+        - ansible_distribution_major_version|int >= 8
 
     - name: set the authorized keys
       authorized_key:
index a6ace7ad694f8623a7bde8fc2d321043c734bfc5..d5e0f3fe45d381918d39574a91557fac628926cd 100644 (file)
@@ -1,8 +1,6 @@
 ---
 # This playbook is used to configure static libvirt&&vagrant slaves.
-# Ubuntu >= 16.04 and CentOS 7.3 are the only tested distros
-#
-# This playbook needs to be updated for EL8 compatibility
+# Ubuntu >= 16.04, CentOS 7/8 are confirmed to work with this playbook.
 #
 # Example usage:
 # On a baremetal node already configured by the github.com/ceph/ceph-cm-ansible common role,
       with_items:
         - git
         - gcc
-        - python-devel
         - libffi-devel
         - java-1.8.0-openjdk-devel
         - qemu-kvm
         - vagrant
         - wget
         - curl
-        - python-virtualenv
         - openssl-devel
         - redhat-lsb-core
         - mock
       when: ansible_os_family == "RedHat"
 
-    - name: install packages from epel
+    - name: install packages from epel (<=7)
       yum:
         name: "{{ item }}"
         state: present
       with_items:
         - jq
         - python-pip
-      when: ansible_os_family == "RedHat"
+        - python-devel
+        - python-virtualenv
+      when:
+        - ansible_os_family == "RedHat"
+        - ansible_distribution_major_version|int <= 7
+
+    - name: install packages from epel (>=8)
+      dnf:
+        name: "{{ item }}"
+        state: present
+        enablerepo: epel
+        update_cache: yes
+      with_items:
+        - jq
+        - python3-pip
+        - python3-devel
+        - python3-virtualenv
+      when:
+        - ansible_os_family == "RedHat"
+        - ansible_distribution_major_version|int >= 8
 
     ### COMMON TASKS ###
     - set_fact:
         state: directory
         owner: "{{ jenkins_user }}"
 
-    - name: install the vagrant-libvirt plugin
+    - name: install the vagrant-libvirt plugin (non-RHEL8)
       shell: vagrant plugin install vagrant-libvirt
       become: yes
       become_user: "{{ jenkins_user }}"
+      when: not (ansible_os_family == "RedHat" and ansible_distribution_major_version == "8")
+
+    - name: install the vagrant-libvirt plugin (RHEL8)
+      command: vagrant plugin install vagrant-libvirt
+      environment:
+        CONFIGURE_ARGS: 'with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib64'
+      when:
+        - ansible_os_family == "RedHat"
+        - ansible_distribution_major_version|int >= 8
 
     - name: set the authorized keys
       authorized_key: