aboutsummaryrefslogtreecommitdiffstats
path: root/kud/deployment_infra/playbooks/preconfigure-cmk.yml
blob: 7aab4e2e45f47e9c5442fb287d8987b6d6e0ec3e (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
---
- hosts: kube-node
  become: yes
  pre_tasks:
    - name: Load kud variables
      include_vars:
        file: kud-vars.yml
  tasks:
    - name: install cmk required packges
      package:
        name: "{{ item }}"
        state: present
      with_items: "{{ cmk_pkgs }}"

    - name: clean CMK directory
      file:
        path: "{{ cmk_dir }}"
        state: absent

    - name: create CMK directory
      file:
        path: "{{ cmk_dir }}"
        state: directory

    - name: clone CMK repository
      command: git clone {{ cmk_git_url }} -b {{ cmk_version }}
      args:
        chdir: "{{ cmk_dir }}"

    - name: read current CMK version
      command: echo v1.4.1
      args:
        chdir: "{{ cmk_dir }}"
      register: cmk_img_version

    - name: build CMK image
      command: make
      args:
        chdir: "{{ cmk_dir }}/CPU-Manager-for-Kubernetes"

    - name: tag CMK image
      command: docker tag cmk:{{ cmk_img_version.stdout }} {{ registry_local_address }}/cmk:{{ cmk_img_version.stdout }}

    - name: build list of CMK hosts
      set_fact:
        cmk_hosts_list: "{{ groups['kube-node'] | join(',') }}"
      when:
        - cmk_use_all_hosts != true
        - (cmk_hosts_list is undefined) or (cmk_hosts_list | length == 0)

- hosts: kube-master[0]
  become: yes
  pre_tasks:
    - name: Load kud variables
      include_vars:
        file: kud-vars.yml
  tasks:
    - name: install cmk required packges
      package:
        name: "{{ item }}"
        state: present
      with_items: "{{ cmk_pkgs }}"