---
- name: Restart fluentd container
  vars:
    service_name: "fluentd"
    service: "{{ common_services[service_name] }}"
  become: true
  kolla_container:
    action: "recreate_or_restart_container"
    common_options: "{{ docker_common_options }}"
    name: "{{ service.container_name }}"
    image: "{{ service.image }}"
    volumes: "{{ service.volumes }}"
    environment: "{{ service.environment }}"
    dimensions: "{{ service.dimensions }}"

- name: Restart kolla-toolbox container
  vars:
    service_name: "kolla-toolbox"
    service: "{{ common_services[service_name] }}"
  become: true
  kolla_container:
    action: "recreate_or_restart_container"
    common_options: "{{ docker_common_options }}"
    name: "{{ service.container_name }}"
    image: "{{ service.image }}"
    privileged: "{{ service.privileged | default(False) }}"
    volumes: "{{ service.volumes }}"
    environment: "{{ service.environment }}"
    dimensions: "{{ service.dimensions }}"
  notify:
    - Initializing toolbox container using normal user

- name: Initializing toolbox container using normal user
  become: true
  command: "{{ kolla_container_engine }} exec -t {{ common_services['kolla-toolbox']['container_name'] }} ansible --version"
  changed_when: false

- name: Restart cron container
  vars:
    service_name: "cron"
    service: "{{ common_services[service_name] }}"
  become: true
  kolla_container:
    action: "recreate_or_restart_container"
    common_options: "{{ docker_common_options }}"
    name: "{{ service.container_name }}"
    image: "{{ service.image }}"
    volumes: "{{ service.volumes }}"
    environment: "{{ service.environment }}"
    dimensions: "{{ service.dimensions }}"
