- name: Delete existing runner-container
  community.docker.docker_container:
    name: "{{ gitea_runner_container_name }}"
    state: absent

- name: Gitea Runner container starten
  community.docker.docker_container:
    name: "{{ gitea_runner_container_name }}"
    image: "{{ gitea_runner_image }}"
    restart_policy: always
    env:
      GITEA_INSTANCE_URL: "{{ gitea_instance_url }}"
      GITEA_RUNNER_REGISTRATION_TOKEN: "{{ gitea_runner_token }}"
      GITEA_RUNNER_NAME: "{{ gitea_runner_name }}"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
