aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/common/tasks/reconfigure.yml
blob: 961c656fa3f240ef8c8a58c976f321b75230c0e9 (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
---
- name: Ensuring the heka container is up
  kolla_docker:
    name: "heka"
    action: "get_container_state"
  register: container_state
  failed_when: container_state.Running == false

- include: config.yml

- name: Checking the heka config
  command: docker exec heka /usr/local/bin/kolla_set_configs --check
  changed_when: false
  failed_when: false
  register: check_result

- name: Getting the heka container config strategy
  kolla_docker:
    name: "heka"
    action: "get_container_env"
  register: container_env

- name: Removing the heka container
  kolla_docker:
    name: "heka"
    action: "remove_container"
  register: remove_container
  when:
    - config_strategy == "COPY_ONCE" or container_env["KOLLA_CONFIG_STRATEGY"] == "COPY_ONCE"
    - check_result.rc == 1

- include: start.yml
  when: remove_container.changed

- name: Restarting the heka container
  kolla_docker:
    name: "heka"
    action: "restart_container"
  when:
    - config_strategy == "COPY_ALWAYS"
    - container_env["KOLLA_CONFIG_STRATEGY"] == "COPY_ALWAYS"
    - check_result.rc == 1