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,7 +3,6 @@ name: Ansible
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
linter: linter:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

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 }}"
@ -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"
@ -102,5 +101,4 @@ 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

@ -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

@ -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) }}"