Skip to content

Commit

Permalink
allow loading of google cloud environment
Browse files Browse the repository at this point in the history
we will need loki config to load with the gcs-bucket
  • Loading branch information
kayiwa committed Dec 16, 2024
1 parent 8887c5d commit 6e1af70
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions roles/logs/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ logs_bind_dn: "{{ omit }}"
logs_bind_password: "{{ omit }}"
logs_loadbalancer_dns_name: "kennyloggin-example.edu"
logs_bucket_name: "kennyloggin-gcs-bucket"
logs_gcs_credentials: "service-account-key.json"
7 changes: 7 additions & 0 deletions roles/logs/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@
ansible.builtin.service:
name: loki
state: restarted

- name: Reload loki service
ansible.builtin.systemd:
name: loki
daemon_reload: true
state: "{{ loki_state | default('reloaded') }}"
become: true
8 changes: 8 additions & 0 deletions roles/logs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
- loki
- promtail

- name: Logs | add gcs credentials file
ansible.builtin.lineinfile:
path: /etc/systemd/system/loki.service
search_string: 'Service'
insertafter: 'ExecStart=/usr/local/bin/loki --config.file=/path/to/loki-config.yaml'
line: 'Environment="GOOGLE_APPLICATION_CREDENTIALS=/etc/loki/{{ logs_gcs_credentials }}"'
notity: Reload loki service

- name: Logs | add loki config
ansible.builtin.template:
src: config.yml.j2
Expand Down

0 comments on commit 6e1af70

Please sign in to comment.