- Reorganized Ansible project structure to follow best practices. - Created dedicated directories: , , , , and . - Categorized playbooks into (host-specific) and (service-specific). - Moved all roles into the directory and standardized their naming conventions. - Relocated to for better variable management. - Renamed to to reflect its global variable scope. - Created to correctly set the to the new directory. - Moved and into the directory. - Added to providing explanations for common commands. - Cleaned up directories from all individual roles to centralize version control.
82 lines
2.2 KiB
YAML
82 lines
2.2 KiB
YAML
---
|
|
- name: Dir-loki
|
|
ansible.builtin.file:
|
|
path: "{{ docker_homepath }}/loki-data"
|
|
owner: "{{ user }}"
|
|
group: "{{ primary_group }}"
|
|
state: directory
|
|
mode: '0711'
|
|
|
|
- name: Dir-grafana
|
|
ansible.builtin.file:
|
|
path: "{{ docker_homepath }}/grafana-data"
|
|
owner: "{{ user }}"
|
|
group: "{{ primary_group }}"
|
|
state: directory
|
|
mode: '0711'
|
|
|
|
- name: Dir-promtail
|
|
ansible.builtin.file:
|
|
path: "{{ docker_homepath }}/promtail-data"
|
|
owner: "{{ user }}"
|
|
group: "{{ primary_group }}"
|
|
state: directory
|
|
mode: '0711'
|
|
|
|
- name: promtail config copy
|
|
template:
|
|
src: ../templates/promtail-config.yml
|
|
dest: "{{ docker_homepath }}/promtail-data/promtail-config.yml"
|
|
owner: "{{ user}}"
|
|
group: "{{ primary_group }}"
|
|
mode: '0644'
|
|
|
|
- name: loki
|
|
community.docker.docker_container:
|
|
name: loki
|
|
user: "{{ uid }}:{{ gid }}"
|
|
image: 'grafana/loki:main-2c878c8'
|
|
restart_policy: unless-stopped
|
|
#ports:
|
|
# - '3100:3100'
|
|
volumes:
|
|
- "{{ docker_homepath }}/loki-data:/loki"
|
|
- "/etc/resolv.conf:/etc/resolv.conf:ro"
|
|
- "/etc/timezone:/etc/timezone:ro"
|
|
- "/etc/localtime:/etc/localtime:ro"
|
|
networks:
|
|
- name: http
|
|
|
|
- name: grafana
|
|
community.docker.docker_container:
|
|
name: grafana
|
|
image: 'grafana/grafana:10.2.6'
|
|
user: "{{ uid }}:{{ gid }}"
|
|
restart_policy: unless-stopped
|
|
#ports:
|
|
# - '3000:3000'
|
|
volumes:
|
|
- "{{ docker_homepath }}/grafana-data:/var/lib/grafana"
|
|
- "/etc/timezone:/etc/timezone:ro"
|
|
- "/etc/localtime:/etc/localtime:ro"
|
|
networks:
|
|
- name: http
|
|
|
|
- name: promtail
|
|
community.docker.docker_container:
|
|
name: promtail
|
|
image: 'grafana/promtail:main-e2952b9'
|
|
user: "0:0"
|
|
restart_policy: unless-stopped
|
|
command: -config.file=/etc/promtail/promtail-config.yml -config.expand-env=true
|
|
#ports:
|
|
# - '3000:3000'
|
|
volumes:
|
|
- "{{ docker_homepath }}/promtail-data:/etc/promtail"
|
|
- "/var/log:/var/log:ro"
|
|
- "/run/log/journal/:/run/log/journal/:ro"
|
|
- "/etc/machine-id:/etc/machine-id:ro"
|
|
- "/etc/timezone:/etc/timezone:ro"
|
|
- "/etc/localtime:/etc/localtime:ro"
|
|
networks:
|
|
- name: http |