This repository was archived by the owner on Apr 1, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 steps :
1313 - uses : actions/checkout@v2
1414 - name : Lint Ansible Playbook
15- uses : ansible/ansible-lint-action@master
15+ uses : ansible/ansible-lint-action@main
Original file line number Diff line number Diff line change @@ -52,18 +52,18 @@ loki_chunk_store_config:
5252
5353loki_schema_config :
5454 configs :
55- - from : 2020-01-01
56- store : boltdb
57- object_store : filesystem
58- schema : v11
59- index :
60- prefix : index_
61- period : 168h
62-
63- chunks :
64- prefix : index_
65- period : 168h
66- row_shards : 16
55+ - from : 2020-01-01
56+ store : boltdb
57+ object_store : filesystem
58+ schema : v11
59+ index :
60+ prefix : index_
61+ period : 168h
62+
63+ chunks :
64+ prefix : index_
65+ period : 168h
66+ row_shards : 16
6767
6868loki_limits_config :
6969 enforce_metric_name : false
@@ -94,9 +94,9 @@ promtail_scrape_config:
9494 host : " {{ ansible_hostname }}"
9595 max_age : 12h
9696 relabel_configs :
97- - source_labels :
98- - __journal__systemd_unit
99- target_label : unit
97+ - source_labels :
98+ - __journal__systemd_unit
99+ target_label : unit
100100
101101promtail_target_config : []
102102promtail_positions_config :
Original file line number Diff line number Diff line change 11---
22- name : restart loki
33 become : true
4- systemd :
4+ ansible.builtin. systemd :
55 daemon_reload : true
66 name : loki
77 state : restarted
88 when : ('loki' in loki_bins)
99
1010- name : reload loki
1111 become : true
12- systemd :
12+ ansible.builtin. systemd :
1313 name : loki
1414 state : reloaded
1515 when : ('loki' in loki_bins)
1616
1717- name : restart promtail
1818 become : true
19- systemd :
19+ ansible.builtin. systemd :
2020 daemon_reload : true
2121 name : promtail
2222 state : restarted
2323 when : ('promtail' in loki_bins)
2424
2525- name : reload promtail
2626 become : true
27- systemd :
27+ ansible.builtin. systemd :
2828 name : promtail
2929 state : reloaded
30- when : ('promtail' in loki_bins)
30+ when : ('promtail' in loki_bins)
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ galaxy_info:
55 description : Deploy and configure Loki and Promtail.
66 issue_tracker_url : https://github.com/weakcamel/ansible-role-loki/issues
77 license : WTFPL
8- min_ansible_version : 2.9
8+ min_ansible_version : " 2.9"
99 platforms :
1010 - name : Ubuntu
1111 versions :
Original file line number Diff line number Diff line change 11---
22- name : configure loki
3- template :
3+ ansible.builtin. template :
44 src : " loki.yml.j2"
55 dest : " {{ loki_config_dir }}/loki.yml"
66 force : true
1212 when : ('loki' in loki_bins)
1313
1414- name : configure promtail
15- template :
15+ ansible.builtin. template :
1616 src : " promtail.yml.j2"
1717 dest : " {{ loki_config_dir }}/promtail.yml"
1818 force : true
2121 mode : 0640
2222 notify :
2323 - reload promtail
24- when : ('promtail' in loki_bins)
24+ when : ('promtail' in loki_bins)
Original file line number Diff line number Diff line change 11---
22- name : create {{ loki_group }} system group
3- group :
3+ ansible.builtin. group :
44 name : " {{ loki_group }}"
55 system : true
66 state : present
77
88- name : create {{ loki_user }} system user
9- user :
9+ ansible.builtin. user :
1010 name : " {{ loki_user }}"
1111 system : true
1212 shell : " /usr/sbin/nologin"
1515 home : " {{ loki_storage_dir }}"
1616
1717- name : create loki data directory
18- file :
18+ ansible.builtin. file :
1919 path : " {{ item }}"
2020 state : directory
2121 owner : loki
2828 when : ('loki' in loki_bins)
2929
3030- name : create loki configuration directories
31- file :
31+ ansible.builtin. file :
3232 path : " {{ item }}"
3333 state : directory
3434 owner : root
4040- block :
4141 - name : download binaries to a temporary folder
4242 become : false
43- get_url :
43+ ansible.builtin. get_url :
4444 url : " https://github.com/grafana/loki/releases/download/v{{ loki_version }}/{{ item }}-linux-{{ go_arch }}.zip"
4545 dest : " /tmp/{{ item }}-{{ loki_version }}-linux-{{ go_arch }}.zip"
4646 checksum : " sha256:{{ __loki_bins_checksum[item] }}"
5353
5454 - name : unpack binaries
5555 become : false
56- unarchive :
56+ ansible.builtin. unarchive :
5757 src : " /tmp/{{ item }}-{{ loki_version }}-linux-{{ go_arch }}.zip"
5858 dest : " /tmp"
5959 creates : " /tmp/{{ item }}-{{ loki_version }}-linux-{{ go_arch }}"
6262 check_mode : false
6363
6464 - name : propagate official binaries
65- copy :
65+ ansible.builtin. copy :
6666 src : " /tmp/{{ item }}-linux-{{ go_arch }}"
6767 dest : " /usr/local/bin/{{ item }}"
6868 mode : 0755
7474 - restart loki
7575
7676- name : create systemd service unit
77- template :
77+ ansible.builtin. template :
7878 src : " {{ item }}.service.j2"
7979 dest : " /etc/systemd/system/{{ item }}.service"
8080 owner : root
Original file line number Diff line number Diff line change 11---
22- name : Assert usage of systemd as an init system
3- assert :
3+ ansible.builtin. assert :
44 that : ansible_service_mgr == 'systemd'
55 msg : " This module only works with systemd"
66
77- block :
88 - name : Get latest release
9- uri :
9+ ansible.builtin. uri :
1010 url : " https://api.github.com/repos/grafana/loki/releases/latest"
1111 method : GET
1212 return_content : true
2121 retries : 5
2222
2323 - name : Set loki version to {{ _latest_release.json.tag_name[1:] }}
24- set_fact :
24+ ansible.builtin. set_fact :
2525 loki_version : " {{ _latest_release.json.tag_name[1:] }}"
2626 when :
2727 - loki_version == "latest"
2828 - loki_binary_local_dir | length == 0
2929
3030- block :
3131 - name : Get checksum list
32- set_fact :
33- __loki_checksums : " {{ lookup('url', 'https://github.com/grafana/loki/releases/download/v' + loki_version + '/SHA256SUMS', wantlist=True) | list }}"
32+ ansible.builtin.set_fact :
33+ __loki_checksums : >-
34+ {{ lookup('url', 'https://github.com/grafana/loki/releases/download/v'
35+ + loki_version + '/SHA256SUMS', wantlist=True) | list }}
3436 run_once : true
3537
3638 - name : Get checksum for bins
37- set_fact :
39+ ansible.builtin. set_fact :
3840 __loki_bins_checksum : " {{ __loki_bins_checksum | default({}) | combine({item[1]: item[0].split()[0]}) }}"
3941 loop : " {{ lookup('nested', __loki_checksums, loki_bins, wantlist=True) }}"
4042 when :
You can’t perform that action at this time.
0 commit comments