]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ansible: New playbook to force reinstall vagrant on CentOS8 1688/head
authorDavid Galloway <dgallowa@redhat.com>
Wed, 21 Oct 2020 15:47:54 +0000 (11:47 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Mon, 2 Nov 2020 20:00:44 +0000 (15:00 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
ansible/examples/centos8-vagrant.yml [new file with mode: 0644]

diff --git a/ansible/examples/centos8-vagrant.yml b/ansible/examples/centos8-vagrant.yml
new file mode 100644 (file)
index 0000000..3868f75
--- /dev/null
@@ -0,0 +1,79 @@
+---
+## This playbook force reinstalls vagrant and the vagrant-libvirt plugin on CentOS 8.  It assumes:
+##   - You've run slave.yml
+##   - You have `html2text` installed locally and it's in your path
+##
+## Example:
+## ansible-playbook -vvv centos8-vagrant.yml --limit braggi21*
+
+- hosts: all
+  become: true
+  user: ubuntu
+  vars:
+    jenkins_user: jenkins-build
+    hackery_packages:
+      - gcc
+      - libguestfs-tools-c
+      - libvirt
+      - libvirt-devel
+      - libxml2-devel
+      - libxslt-devel
+      - make
+      - ruby-devel
+
+  tasks:
+    - name: Get the latest vagrant version
+      shell: curl -s https://releases.hashicorp.com/vagrant/ | html2text | grep '*' | grep -v '../' | head -n 1 | cut -d '_' -f2
+      delegate_to: localhost
+      register: latest_vagrant_version
+
+    - name: Set the latest vagrant version URL
+      set_fact:
+        latest_vagrant_url: "https://releases.hashicorp.com/vagrant/{{ latest_vagrant_version.stdout }}/vagrant_{{ latest_vagrant_version.stdout }}_x86_64.rpm"
+
+    ## Wipe out vagrant stuff
+    # From https://github.com/vagrant-libvirt/vagrant-libvirt/issues/943#issuecomment-463678158
+    - name: Wipe out vagrant stuff
+      shell: |
+        rvm implode
+        gem uninstall --all
+      become_user: "{{ jenkins_user }}"
+      ignore_errors: true
+
+    - name: Wipe out more vagrant stuff
+      file:
+        path: "{{ item }}"
+        state: absent
+      with_items:
+        - "/home/{{ jenkins_user }}/.vagrant.d/gems"
+        - "/home/{{ jenkins_user }}/.vagrant.d/plugins.json"
+
+    - name: Remove vagrant
+      dnf:
+        name: vagrant
+        state: absent
+
+    - name: Install packages
+      dnf:
+        name: "{{ hackery_packages + [ latest_vagrant_url ] }}"
+        state: present
+
+    # https://github.com/vagrant-libvirt/vagrant-libvirt/issues/1127#issuecomment-713651332
+    - name: Library hackery
+      shell: |
+        cd /tmp
+        wget http://vault.centos.org/8.2.2004/BaseOS/Source/SPackages/krb5-1.17-18.el8.src.rpm
+        rpm2cpio krb5-1.17-18.el8.src.rpm | cpio -imdV
+        tar xf krb5-1.17.tar.gz; cd krb5-1.17/src
+        LDFLAGS='-L/opt/vagrant/embedded/' ./configure
+        make
+        sudo cp lib/libk5crypto.so.3 /opt/vagrant/embedded/lib64/
+
+    # https://github.com/vagrant-libvirt/vagrant-libvirt/issues/943#issuecomment-479360033
+    - name: Install the vagrant-libvirt plugin (EL)
+      shell: vagrant plugin install vagrant-libvirt
+      become_user: "{{ jenkins_user }}"
+      environment:
+        CONFIGURE_ARGS: 'with-ldflags=-L/opt/vagrant/embedded/lib with-libvirt-include=/usr/include/libvirt with-libvirt-lib=/usr/lib'
+        GEM_HOME: '~/.vagrant.d/gems'
+        GEM_PATH: '$GEM_HOME:/opt/vagrant/embedded/gems'