Wolfgang Kulhanek
2018-08-28 4e42f7fca755c5f0a317466364e7e5e50acb8079
ansible/roles/ocp-infra-enable-custom-catalog/tasks/main.yml
@@ -20,14 +20,17 @@
    command: "oc volume dc/static --add --name=custom --configmap-name=webconsole-customization --mount-path=/opt/app-root/src/custom -n openshift-web-console"
  - name: Get route for static server
    command: "oc get route/static -n openshift-web-console -o jsonpath='{ .spec.host }' "
    register: webconsole-url
    command: "oc get route/static -n openshift-web-console -o jsonpath='{ .spec.host }'"
    register: webconsole_url
  - name: Export webconsole-config yaml file from configmap
    shell: "oc get cm/webconsole-config -n openshift-web-console -o jsonpath='{ .data.webconsole-config\\.yaml }' > /tmp/webconsole-config.yaml"
  - name: Patch webconsole-config.yml
    shell: "sed -i -e 's/scriptURLs: \\[\\]/scriptURLs:/g' -e '/scriptURLs:/a\\    - https:\\/\\/{{ webconsole-url.stdout }}\\/custom\\/custom-categories\\.js' /tmp/webconsole-config.yaml"
    lineinfile:
      path:   "/tmp/webconsole-config.yaml"
      regexp: "  scriptURLs."
      line:   "  scriptURLs:\n  - https://{{ webconsole_url.stdout }}/custom/custom-categories.js"
  - name: Import webconsole-config yaml file from configmap
    shell: "oc create configmap webconsole-config --from-file=webconsole-config.yaml=/tmp/webconsole-config.yaml -n openshift-web-console --dry-run -o yaml | oc replace -f -"