summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml
blob: 1c691b8ebeba13c2f144cb944685727177460bf7 (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
##############################################################################
# Copyright (c) 2018 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---

- name: fetch admin.conf
  fetch:
    src: /etc/kubernetes/admin.conf
    dest: /opt/admin.conf
    flat: "yes"
  when: inventory_hostname == groups['kube_master'][0]

- name: Create  heapster dest directory
  file:
    path: "{{local_release_dir}}/heapster"
    state: directory
    recurse: "yes"
  when:
    - heapster.enabled
    - inventory_hostname == groups['kube_master'][0]

- name: get the package of heapster
  get_url:
    url: "{{heapster_download_url}}"
    dest: "{{local_release_dir}}/heapster"
    owner: "{{ heapster.owner|default(omit) }}"
    mode: "{{ heapster.mode|default(omit) }}"
  register: get_url_result
  until: "'OK' in get_url_result.msg or 'file already exists' in get_url_result.msg"
  retries: 4
  delay: "{{ retry_stagger | random + 3 }}"
  when:
    - heapster.enabled
    - inventory_hostname == groups['kube_master'][0]

- name: untar the file of heapster
  shell: |
    cd  "{{ local_release_dir }}/heapster";
    tar  zxvf "heapster-{{ heapster.version }}.tar.gz"
  when:
    - heapster.enabled
    - inventory_hostname == groups['kube_master'][0]

- name: install the heapster
  shell: |
    cd "{{ local_release_dir }}/heapster/heapster-{{ heapster.version }}/deploy/";
    ./kube.sh start
  when:
    - heapster.enabled
    - inventory_hostname == groups['kube_master'][0]