Prettier

This commit is contained in:
SebClem 2022-03-04 14:43:35 +01:00
parent 92eed52d35
commit 03bd964f37
No known key found for this signature in database
GPG Key ID: 3D8E353F900B1305
12 changed files with 51 additions and 59 deletions

View File

@ -3,13 +3,12 @@ name: Ansible
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
linter: linter:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Lint Ansible Playbook - name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@master uses: ansible/ansible-lint-action@master
release: release:
needs: needs:
@ -19,4 +18,4 @@ jobs:
- name: galaxy - name: galaxy
uses: robertdebock/galaxy-action@1.0.3 uses: robertdebock/galaxy-action@1.0.3
with: with:
galaxy_api_key: ${{ secrets.galaxy_api_key }} galaxy_api_key: ${{ secrets.galaxy_api_key }}

View File

@ -1,3 +1,7 @@
{ {
"recommendations": ["redhat.ansible", "dhoeric.ansible-vault", "esbenp.prettier-vscode"] "recommendations": [
"redhat.ansible",
"dhoeric.ansible-vault",
"esbenp.prettier-vscode"
]
} }

View File

@ -4,6 +4,6 @@
"hosts": "yaml", "hosts": "yaml",
"*.yml": "ansible" "*.yml": "ansible"
}, },
"ansible.ansible.useFullyQualifiedCollectionNames": true, "ansible.ansible.useFullyQualifiedCollectionNames": true,
"editor.formatOnSave": true "editor.formatOnSave": true
} }

View File

@ -1,30 +1,25 @@
Role Name # Role Name
=========
Deploy and configure [Loki/Promtail](https://github.com/grafana/loki) using Ansible. Deploy and configure [Loki/Promtail](https://github.com/grafana/loki) using Ansible.
Requirements ## Requirements
------------
- Ansible >= 2.9 - Ansible >= 2.9
Example Playbook ## Example Playbook
------------
Install Loki and Promtail in local machine Install Loki and Promtail in local machine
```yml ```yml
- hosts: servers - hosts: servers
roles: roles:
- { role: diogenxs.loki, loki_bins: ['loki', 'promtail'] } - { role: diogenxs.loki, loki_bins: ["loki", "promtail"] }
``` ```
License ## License
-------
WTFPL see [LICENSE](license) WTFPL see [LICENSE](license)
Author Information ## Author Information
------------------
https://diogenxs.dev https://diogenxs.dev

View File

@ -1,6 +1,6 @@
--- ---
# loki version to install # loki version to install
loki_version: 'latest' loki_version: "latest"
# loki bins to install # loki bins to install
loki_bins: loki_bins:
@ -19,10 +19,10 @@ loki_listen_address: 127.0.0.1
loki_listen_port: 3100 loki_listen_port: 3100
promtail_listen_address: "{{ loki_listen_address }}" promtail_listen_address: "{{ loki_listen_address }}"
loki_binary_local_dir: '' loki_binary_local_dir: ""
loki_target: all loki_target: all
loki_auth_enabled: 'false' loki_auth_enabled: "false"
loki_server_config: loki_server_config:
http_listen_address: "{{ loki_listen_address }}" http_listen_address: "{{ loki_listen_address }}"
http_listen_port: "{{ loki_listen_port }}" http_listen_port: "{{ loki_listen_port }}"
@ -52,18 +52,18 @@ loki_chunk_store_config:
loki_schema_config: loki_schema_config:
configs: configs:
- from: 2020-01-01 - from: 2020-01-01
store: boltdb store: boltdb
object_store: filesystem object_store: filesystem
schema: v11 schema: v11
index: index:
prefix: index_ prefix: index_
period: 168h period: 168h
chunks: chunks:
prefix: index_ prefix: index_
period: 168h period: 168h
row_shards: 16 row_shards: 16
loki_limits_config: loki_limits_config:
enforce_metric_name: false enforce_metric_name: false
@ -76,7 +76,6 @@ loki_table_manager_config:
retention_deletes_enabled: false retention_deletes_enabled: false
retention_period: 0s retention_period: 0s
promtail_client_config: promtail_client_config:
- url: "http://{{ loki_listen_address }}:{{ loki_listen_port }}/loki/api/v1/push" - url: "http://{{ loki_listen_address }}:{{ loki_listen_port }}/loki/api/v1/push"
@ -94,13 +93,12 @@ promtail_scrape_config:
host: "{{ ansible_hostname }}" host: "{{ ansible_hostname }}"
max_age: 12h max_age: 12h
relabel_configs: relabel_configs:
- source_labels: - source_labels:
- __journal__systemd_unit - __journal__systemd_unit
target_label: unit target_label: unit
promtail_target_config: [] promtail_target_config: []
promtail_positions_config: promtail_positions_config:
filename: /tmp/positions.yaml filename: /tmp/positions.yaml
loki_docker_driver: false
loki_docker_driver: false

View File

@ -36,4 +36,4 @@
- name: Restart Docker - name: Restart Docker
ansible.builtin.service: ansible.builtin.service:
name: docker name: docker
state: restarted state: restarted

View File

@ -22,4 +22,4 @@ galaxy_info:
- monitoring - monitoring
- grafana - grafana
- prometheus - prometheus
dependencies: [] dependencies: []

View File

@ -21,4 +21,4 @@
mode: 0640 mode: 0640
notify: notify:
- reload promtail - reload promtail
when: ('promtail' in loki_bins) when: ('promtail' in loki_bins)

View File

@ -1,5 +1,4 @@
--- ---
- name: Install Loki docker driver - name: Install Loki docker driver
community.docker.docker_plugin: community.docker.docker_plugin:
plugin_name: grafana/loki-docker-driver:latest plugin_name: grafana/loki-docker-driver:latest
@ -11,7 +10,6 @@
plugin_name: loki plugin_name: loki
state: enable state: enable
- name: Add docker deamon.json - name: Add docker deamon.json
ansible.builtin.template: ansible.builtin.template:
src: daemon.json.j2 src: daemon.json.j2

View File

@ -79,7 +79,6 @@
loop: "{{ loki_bins }}" loop: "{{ loki_bins }}"
when: _download_archive is changed when: _download_archive is changed
- name: Create systemd service unit - name: Create systemd service unit
template: template:
src: "{{ item }}.service.j2" src: "{{ item }}.service.j2"
@ -91,13 +90,12 @@
loop: "{{ loki_bins }}" loop: "{{ loki_bins }}"
when: item == 'loki' or item == 'promtail' when: item == 'loki' or item == 'promtail'
- name: Find temps files to del - name: Find temps files to del
find: find:
paths: /tmp paths: /tmp
file_type: file file_type: file
patterns: 'loki-*-linux-{{ go_arch }}.zip,promtail-*-linux-{{ go_arch }}.zip' patterns: "loki-*-linux-{{ go_arch }}.zip,promtail-*-linux-{{ go_arch }}.zip"
excludes: 'loki-{{ loki_version }}-linux-{{ go_arch }}.zip,promtail-{{ loki_version }}-linux-{{ go_arch }}.zip' excludes: "loki-{{ loki_version }}-linux-{{ go_arch }}.zip,promtail-{{ loki_version }}-linux-{{ go_arch }}.zip"
register: to_del register: to_del
- name: Clean temp files - name: Clean temp files

View File

@ -50,6 +50,6 @@
- name: Install dnspython - name: Install dnspython
pip: pip:
name: name:
- dnspython - dnspython
- docker - docker

View File

@ -1,9 +1,9 @@
--- ---
go_arch_map: go_arch_map:
i386: '386' i386: "386"
x86_64: 'amd64' x86_64: "amd64"
aarch64: 'arm64' aarch64: "arm64"
armv7l: 'armv7' armv7l: "armv7"
armv6l: 'armv6' armv6l: "armv6"
go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}" go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}"