---
# Placeholder — serves a static HTML page at k8s.ladkau.de
- name: Create k8s placeholder directories
  ansible.builtin.file:
    path: "{{ item }}"
    state: directory
    owner: root
    group: root
    mode: "0755"
  loop:
    - "{{ k8s_data_dir }}"
    - "{{ k8s_data_dir }}/html"
  tags: k8s

- name: Deploy placeholder HTML page
  ansible.builtin.copy:
    src: index.html
    dest: "{{ k8s_data_dir }}/html/index.html"
    owner: root
    group: root
    mode: "0644"
  tags: k8s

- name: Deploy Docker Compose file
  ansible.builtin.template:
    src: docker-compose.yml.j2
    dest: "{{ k8s_data_dir }}/docker-compose.yml"
    owner: root
    group: root
    mode: "0644"
  notify: Restart k8s
  tags: k8s

- name: Start k8s placeholder
  community.docker.docker_compose_v2:
    project_src: "{{ k8s_data_dir }}"
    state: present
    pull: missing
  tags: k8s
