Merge pull request #1 from weakcamel/idempotent_loki_install

This commit is contained in:
Waldek Maleska 2021-02-26 11:08:54 +00:00 committed by GitHub
commit 07e0d4413a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 27 deletions

View File

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

15
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,15 @@
---
name: Lint
"on":
- push
- pull_request
jobs:
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint Ansible Playbook
uses: ansible/ansible-lint-action@master

15
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,15 @@
---
name: Publish to Galaxy
"on":
release:
types: [created]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: galaxy
uses: robertdebock/galaxy-action@1.1.0
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}

View File

@ -3,6 +3,8 @@ 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.
This is a fork of a simple and extremely useful diogenxs.loki role.
Requirements Requirements
------------ ------------
@ -16,7 +18,9 @@ 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
vars:
loki_bins: ['loki', 'promtail'] }
``` ```
License License
@ -27,4 +31,6 @@ WTFPL see [LICENSE](license)
Author Information Author Information
------------------ ------------------
https://diogenxs.dev Fork maintainer: [weakcamel](https://galaxy.ansible.com/weakcamel)
Original author (all credits due): https://diogenxs.dev

View File

@ -38,7 +38,7 @@
- "{{ loki_config_dir }}" - "{{ loki_config_dir }}"
- block: - block:
- name: download binaries to local folder - name: download binaries to a temporary folder
become: false become: false
get_url: get_url:
url: "https://github.com/grafana/loki/releases/download/v{{ loki_version }}/{{ item }}-linux-{{ go_arch }}.zip" url: "https://github.com/grafana/loki/releases/download/v{{ loki_version }}/{{ item }}-linux-{{ go_arch }}.zip"
@ -49,7 +49,6 @@
retries: 5 retries: 5
delay: 2 delay: 2
loop: "{{ loki_bins }}" loop: "{{ loki_bins }}"
delegate_to: localhost
check_mode: false check_mode: false
- name: unpack binaries - name: unpack binaries
@ -59,7 +58,6 @@
dest: "/tmp" dest: "/tmp"
creates: "/tmp/{{ item }}-{{ loki_version }}-linux-{{ go_arch }}" creates: "/tmp/{{ item }}-{{ loki_version }}-linux-{{ go_arch }}"
loop: "{{ loki_bins }}" loop: "{{ loki_bins }}"
delegate_to: localhost
check_mode: false check_mode: false
- name: propagate official binaries - name: propagate official binaries
@ -69,6 +67,7 @@
mode: 0755 mode: 0755
owner: root owner: root
group: root group: root
remote_src: true
loop: "{{ loki_bins }}" loop: "{{ loki_bins }}"
notify: notify:
- restart loki - restart loki