Преглед изворни кода

add a fix for logging lab scripts

Grega Bremec пре 1 година
родитељ
комит
08c23e1303
2 измењених фајлова са 54 додато и 0 уклоњено
  1. 2 0
      pre-flight.yml
  2. 52 0
      roles/fix-labs/tasks/main.yml

+ 2 - 0
pre-flight.yml

@@ -10,4 +10,6 @@
       tags: check
     - role: fix-operators
       tags: fix
+    - role: fix-labs
+      tags: labs
 ...

+ 52 - 0
roles/fix-labs/tasks/main.yml

@@ -0,0 +1,52 @@
+---
+# Fixes the DO380 class playbooks for logging operator and related artifacts to
+# use the original operator catalogs rather than the do380-catalog.
+#
+# 1. make sure /usr/local/lib/ansible is there, OR extract http://materials.example.com/ansible.tgz
+#     (examples in labtool.do380.shlib)
+#
+# 2. perform the modifications needed for logging to deploy correctly:
+#
+#     - change do380-catalog to redhat-operators
+#        /usr/local/lib/ansible/lso/set_lso.yml
+#        /usr/local/lib/ansible/logging/files/elasticsearch-operator.yml
+#        /usr/local/lib/ansible/logging/files/logging-operator.yml
+#
+#     - remove image attribute from eventrouter
+#        /usr/local/lib/ansible/logging/set_logging.yml
+#
+- name: Check if Ansible labs are there.
+  stat:
+    path: /usr/local/lib/ansible
+  register: ansible_dir
+
+- name: Unarchive Ansible files
+  become: yes
+  unarchive:
+    src: http://materials.example.com/ansible.tgz
+    dest: /usr/local/lib/
+    owner: root
+    group: root
+    remote_src: true
+  when: not ansible_dir.stat.exists
+
+- name: Replace all references to do380-catalog in any manifest.
+  become: yes
+  lineinfile:
+    path: "{{ item }}"
+    regexp: "(^\\s+source:) do380-catalog"
+    backrefs: yes
+    line: "\\1 redhat-operators"
+    state: present
+  loop:
+    - /usr/local/lib/ansible/lso/set_lso.yml
+    - /usr/local/lib/ansible/logging/files/elasticsearch-operator.yml
+    - /usr/local/lib/ansible/logging/files/logging-operator.yml
+
+- name: Remove the IMAGE and parameters attributes from eventrouter spec.
+  become: yes
+  lineinfile:
+    path: /usr/local/lib/ansible/logging/set_logging.yml
+    regexp: "(parameters|IMAGE):"
+    state: absent
+...