summaryrefslogtreecommitdiffstats
path: root/roles/openshift_metrics/tasks/main.yaml
blob: b67077bcaebff405fb6bd0e256ebb867bbe107e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
- local_action: shell python -c 'import passlib' 2>/dev/null || echo not installed
  register: passlib_result
  become: false

- name: Check that python-passlib is available on the control host
  assert:
    that:
      - "'not installed' not in passlib_result.stdout"
    msg: "python-passlib rpm must be installed on control host"

- name: Set default image variables based on openshift_deployment_type
  include_vars: "{{ item }}"
  with_first_found:
    - "{{ openshift_deployment_type }}.yml"
    - "default_images.yml"

- name: Set metrics image facts
  set_fact:
    openshift_metrics_image_prefix: "{{ openshift_metrics_image_prefix | default(__openshift_metrics_image_prefix) }}"
    openshift_metrics_image_version: "{{ openshift_metrics_image_version | default(__openshift_metrics_image_version) }}"

- name: Create temp directory for doing work in on target
  command: mktemp -td openshift-metrics-ansible-XXXXXX
  register: mktemp
  changed_when: False

- name: Create temp directory for all our templates
  file: path={{mktemp.stdout}}/templates state=directory mode=0755
  changed_when: False
  when: openshift_metrics_install_metrics | bool

- name: Create temp directory local on control node
  local_action: command mktemp -d
  register: local_tmp
  changed_when: False
  become: false

- name: Copy the admin client config(s)
  command: >
     cp {{ openshift.common.config_base}}/master/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  changed_when: False
  check_mode: no
  tags: metrics_init

- include_tasks: install_metrics.yaml
  when:
    - openshift_metrics_install_metrics | bool

- include_tasks: uninstall_metrics.yaml
  when:
    - not openshift_metrics_install_metrics | bool

- include_tasks: uninstall_hosa.yaml
  when: not openshift_metrics_install_hawkular_agent | bool

- name: Delete temp directory
  local_action: file path=local_tmp.stdout state=absent
  tags: metrics_cleanup
  changed_when: False
  check_mode: no
  become: false