--- # The image is configured to run by default as user promtail with UID 10001 and GID 10001. # You can use a different user, specially if you are using bind mounts, by specifying # the UID with a docker run command and using --user=UID with a numeric UID suited to your needs. # Tasks for Promtail role - name: Pull Promtail image docker_image: name: "{{ promtail_image }}" source: pull force_source: yes - name: Ensure Promtail Directory exists file: path: "{{ promtail_directory }}" state: directory group: "{{ promtail_user }}" owner: "{{ promtail_user }}" mode: 0755 - name: Copy the Promtail conf file template: src: "files/promtail-config.yaml" dest: "{{ promtail_directory }}/promtail-config.yaml" group: "{{ promtail_user }}" owner: "{{ promtail_user }}" mode: 0644 - name: Create Promtail container docker_container: name: "{{ promtail_container }}" image: "{{ promtail_image }}" state: started restart_policy: "unless-stopped" links: - "{{ loki_container }}:loki" volumes: - "{{ promtail_directory }}:/mnt/config" - "/var/log:/var/log:ro" - "/var/lib/docker/containers:/var/lib/docker/containers:ro" # published_ports: # - "127.0.0.1:{{ promtail_port }}:9080" command: - "-config.file=/mnt/config/promtail-config.yaml"