main.yaml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ---
  2. - local_action: shell python -c 'import passlib' 2>/dev/null || echo not installed
  3. register: passlib_result
  4. - name: Check that python-passlib is available on the control host
  5. assert:
  6. that:
  7. - "'not installed' not in passlib_result.stdout"
  8. msg: "python-passlib rpm must be installed on control host"
  9. - name: Set default image variables based on deployment_type
  10. include_vars: "{{ item }}"
  11. with_first_found:
  12. - "{{ openshift_deployment_type | default(deployment_type) }}.yml"
  13. - "default_images.yml"
  14. - name: Set metrics image facts
  15. set_fact:
  16. openshift_metrics_image_prefix: "{{ openshift_metrics_image_prefix | default(__openshift_metrics_image_prefix) }}"
  17. openshift_metrics_image_version: "{{ openshift_metrics_image_version | default(__openshift_metrics_image_version) }}"
  18. - name: Create temp directory for doing work in on target
  19. command: mktemp -td openshift-metrics-ansible-XXXXXX
  20. register: mktemp
  21. changed_when: False
  22. - name: Create temp directory for all our templates
  23. file: path={{mktemp.stdout}}/templates state=directory mode=0755
  24. changed_when: False
  25. when: openshift_metrics_install_metrics | bool
  26. - name: Create temp directory local on control node
  27. local_action: command mktemp -d
  28. register: local_tmp
  29. changed_when: False
  30. become: false
  31. - name: Copy the admin client config(s)
  32. command: >
  33. cp {{ openshift.common.config_base}}/master/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  34. changed_when: False
  35. check_mode: no
  36. tags: metrics_init
  37. - include: "{{ (openshift_metrics_install_metrics | bool) | ternary('install_metrics.yaml','uninstall_metrics.yaml') }}"
  38. - name: Delete temp directory
  39. local_action: file path=local_tmp.stdout state=absent
  40. tags: metrics_cleanup
  41. changed_when: False
  42. check_mode: no