]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
cobbler: Change the way we convert non-stream to stream 666/head
authorDavid Galloway <dgallowa@redhat.com>
Wed, 2 Feb 2022 22:20:07 +0000 (17:20 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Thu, 10 Mar 2022 15:28:05 +0000 (10:28 -0500)
The old method doesn't work since the non-stream repos have moved.

Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/cobbler/templates/triggers/install/post/cephlab_ansible.sh
tools/convert-to-centos-stream.yml

index 379762bf31ec0638610ddc18a759dbb372fb7543..0fa62f0986f6b7f1c563c5e1922fbb6625ee5750 100644 (file)
@@ -27,6 +27,21 @@ flock --close ./.lock git pull
 export ANSIBLE_SSH_PIPELINING=1
 export ANSIBLE_HOST_KEY_CHECKING=False
 
+# Set up Stream repos
+# We have to do it this way because
+# 1) Stream ISOs don't work with Cobbler https://bugs.centos.org/view.php?id=18188
+# 2) Since we use a non-stream profile then convert it to stream, we can't run any package related tasks
+#    until the stream repo files are in place. e.g., The zap ansible tag has some package tasks that fail
+#    unless we get the repos in place first.
+if [[ $profile == *"8.stream"* ]]
+then
+    ansible-playbook tools/convert-to-centos-stream.yml -v --limit $name* 2>&1 >> /var/log/ansible/$name.log
+elif [[ $profile == *"9.stream"* ]]
+then
+    # For some reason, we end up with no repos on the first boot without doing this.
+    ansible-playbook testnodes.yml --tags repos -v --limit $name* 2>&1 >> /var/log/ansible/$name.log
+fi
+
 # Tell ansible to create users, populate authorized_keys, and zap non-root disks
 ansible-playbook testnodes.yml -v --limit $name* --tags user,pubkeys,zap 2>&1 > /var/log/ansible/$name.log
 # Now run the rest of the playbook. If it fails, at least we have access.
@@ -37,13 +52,6 @@ ansible-playbook testnodes.yml -v --limit $name* --tags user,pubkeys,zap 2>&1 >
 if [[ $profile == *"-stock" ]]
 then
     exit 0
-elif [[ $profile == *"8.stream"* ]]
-then
-    ansible-playbook tools/convert-to-centos-stream.yml -v --limit $name* 2>&1 >> /var/log/ansible/$name.log
-elif [[ $profile == *"9.stream"* ]]
-then
-    # For some reason, we end up with no repos on the first boot without doing this.
-    ansible-playbook testnodes.yml --tags repos -v --limit $name* 2>&1 >> /var/log/ansible/$name.log
 fi
 ansible-playbook cephlab.yml -v --limit $name* --skip-tags user,pubkeys,zap 2>&1 >> /var/log/ansible/$name.log &
 popd
index 7a2975761b8753e73bdd93dbdabbd00f26109713..ba0d550fa92a1469ff4b21af878e45b8cabeb736 100644 (file)
@@ -8,6 +8,39 @@
   gather_facts: true
   tasks:
 
+  - name: List repo files
+    find:
+      paths: /etc/yum.repos.d/
+      file_type: file
+      patterns: 'CentOS-Linux-*.repo'
+    register: pre_stream_repo_files
+    when: ansible_distribution == 'CentOS'
+
+  # From ansible docs: 'replace: If not set, matches are removed entirely.'
+  - name: Remove all mirrorlists
+    replace:
+      path: "{{ item.path }}"
+      regexp: '^mirrorlist=.*'
+    with_items: "{{ pre_stream_repo_files.files }}"
+    when: ansible_distribution == 'CentOS'
+
+  - name: Uncomment baseurls
+    replace:
+      path: "{{ item.path }}"
+      regexp: '^mirrorlist=.*'
+      regexp: '^\s*#*\s*(baseurl=.*)'
+      replace: '\1'
+    with_items: "{{ pre_stream_repo_files.files }}"
+    when: ansible_distribution == 'CentOS'
+
+  - name: Point baseurls to archive server
+    replace:
+      path: "{{ item.path }}"
+      regexp: 'mirror.centos.org/\$contentdir/\$releasever'
+      replace: 'vault.centos.org/8.5.2111'
+    with_items: "{{ pre_stream_repo_files.files }}"
+    when: ansible_distribution == 'CentOS'
+
   - name: Swap to Stream Repos
     command: dnf -y swap centos-linux-repos centos-stream-repos
     when: ansible_distribution == 'CentOS'