---

- name: pod name ranges
  set_fact:
    pod_names: "[{% for i in range(1, pod_count + 1) %}{{ i }}{% if not loop.last %},{% endif %}{% endfor %}]"
  tags: service

- name: deconst configuration directory
  file:
    path: /etc/deconst
    state: directory
    owner: root
    group: root
    mode: 0755
  sudo: yes
  tags: service

- name: environment variables
  template:
    src: deconst-environment.j2
    dest: /etc/deconst/environment.sh
    owner: root
    group: root
    mode: 0600
  sudo: yes
  tags: service

- name: start each container
  service: name={{ item[1] }}@{{ item[0] }}.service state=started enabled=true
  with_nested:
  - pod_names
  - launcher_units
  sudo: yes
  tags: service

---

- name: pod name ranges
  set_fact:
    pod_names: "[{% for i in range(1, pod_count + 1) %}{{ i }}{% if not loop.last %},{% endif %}{% endfor %}]"
  tags: service

- name: deconst configuration directory
  file:
    path: /etc/deconst
    state: directory
    owner: root
    group: root
    mode: 0755
  sudo: yes
  tags: service

- name: environment variables
  template:
    src: deconst-environment.j2
    dest: /etc/deconst/environment.sh
    owner: root
    group: root
    mode: 0600
  sudo: yes
  tags: service

- name: unit files
  copy:
    src: "{{ item }}@.service"
    dest: /etc/systemd/system/{{ item }}@.service
    owner: root
    group: root
    mode: 0644
  with_items:
  - launcher_units
  sudo: yes
  tags: service

- name: container services
  service: name={{ item[1] }}@{{ item[0] }}.service state=started enabled=true
  with_nested:
  - pod_names
  - launcher_units
  sudo: yes
  tags: service

Install unit files and launch the services.
Install unit files and launch the services.
