Skip to content

Commit

Permalink
add gcs credentials
Browse files Browse the repository at this point in the history
add the json file that connects loads the environment
  • Loading branch information
kayiwa committed Dec 23, 2024
1 parent 686b3bc commit 78c1eea
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 6 deletions.
2 changes: 1 addition & 1 deletion roles/logs/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +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"
logs_gcs_credentials: "pul-gcdc-account-key.json"
123 changes: 123 additions & 0 deletions roles/logs/files/pul-gcdc-staging-account-key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
$ANSIBLE_VAULT;1.1;AES256
38313430653437306362393933326536373131376563323162343035663038383537613333313962
3037643238316230373534663938666335343566326665630a303566633437316464343232363030
65623834303361633235393532663836356462346462626536646234663639303864376436353761
3539336539323230310a363762626234353733356464333436663930626665393362633065633865
30663937656337326434366266303263643963633835353035353161306566393266663335623264
30373066653863393537663736306638623362613461386666343233373662386139346563393064
36336362666132653932353435306633643731326130316633616365313863366166393438653765
65333461623864666365336535316536336532356638326133356239333032356165363330653663
35616665333665633732613132393434346164316362626239626537633932663635623937316434
65363362353132386235363138326134303934623836393466613839616664636335626331313461
35326363396432656265393432613638373635633634643561633761336239643537633539346565
65353934336132616564343363393637613735303561636466663236303434393333326531316166
31623138343563326461356539303931323938653764306662343937663064636161393562333233
39326635313834636164663030663431353533363965383537323035356334616634343561356636
32303437633530653739393033363365616530353161303035376562353930383036313430326561
38333135616262343432356336396538303233363136636433373362666432353362393836383237
62366464396338353935343863666238343265633737656236383233346232373630663461636264
62646661653833313936663933613935353739393730323365396165626265356533393162623031
64303666643665346362646136336564363761393739393336663463376233363832343834313333
31616631353531636538333737306432313436363439383666323030383463356664666661343239
65353632363062653364663835383362393738373735303165353265353938613765656330373465
35633335646530636632353330303737663138643864363761613266316361353438373933316538
32316264646532343461383563343066383362623432356632653764373036353963366237613163
34373562623833393038656438323361323230663938636563633264356437343032646663613266
38396562333162306663643931313262363238376636313038383037383166303966636338633565
33303130646462356339363663396632396138363263623064653039663562303261643662353738
35326436303031663034383464666637663133626162336563313437626165316462636165613533
35656265633339626266643163356436333661336136323637383731626233393235353436316233
37313132323032333966663634376264623636663834383336373864633565646161626266333138
32626636643933663766313834313437626566343131656562373634353737343232356166306365
38626538643263373735333139343565666134313661623037656632323233656136333135346234
36656130306366333534613338343161626530356530323636663161363933353731356630383936
30393430656666313531393233363630376436613965386337373436323766303166343437313132
32316631333136333531653463653537653032366562383834333938653365353266656364363435
33353538346236396261653632653062623066613836363133646133393564653135636634333239
63356535393132316237363537313439613462396537313762633737633662323236366335376639
62313934386463333135616564306164306537363765363238616266396662326435653066646561
39326132303038623539613038633737656164323034656333646132386662336634326163643837
65643037633837616336383963363666393439643532306362303435376635663861633330373936
37366637366635366634656364303535323035396462653638376339313935383531373434656130
31323638333162613166393665326666356438646230306539326264633139383234316663633538
61636162313732376233326538353839636466376537376332366538356338343965646432633866
32623866643665653534393038343064356437333136323336613732366463666630386635333335
36323139643637316164643063383532643335653930653133633636613761386566313839326335
62656264356338633737363230393263643763663665663339613131333532626539636637613732
38303261306362306634396631346636623436666665313332653762616334386535326461303531
65623464353661306164633932663033333563373863323133396432653964363131303330323662
38633530326330313534323665303865393263383736396536383535346530346661316131343164
63336265343138636230626662396232356366623238393361363063653137343431633265633035
31333238323537306536633364303464653832303263306464656463366162373461346162646363
62303462373862333837353161393766373838656631643832326134646436313331343535316434
61356134376138353933393932383764366666333933393635356231616563613231626361623531
64393638636663356338666435393438363634353833393637323164336332626630373062393439
38313761633339653539396465366162343663366164626231393563373665646136616465383832
35623633356135393239633664356335326136623931636534613433323338313065636564613934
35646262333435666633346232336333653534383866663831313036663233623461633733653039
63333935663034363431323064343836646264616166366134346663326230393335336461646662
61376562386638666461316563366536326637363534383230336538396661363033616165653061
36316330663963656337346431633535346464633339313864396434383434303636323938653335
65663835653738646139613761393632373735653363653835303630333464653530353434363038
33346338376361323836343034613566306133646538356464346132666134333036356335646565
65306637343430356332316462306536623932393336373132353862306466626466396231666431
37363332336530386563303133383934663933316534626430373536373733353364643465346236
39333161373232353462363431336635366336336631643431356439653837356433366136613162
36353636626231363261663362303332316136313134376564376535366435633737653030376635
30376339653833323564316139356539363561653532393432646334303565336532343531306362
61373338333762393537613562353666393763663539336634336330623863396162353935643961
39333337613235323036616233646636656361393065623537303566366636313137343764313665
65626331353164653435396439383937633866373262393739326439643532326639663934343265
63626139373766353135626165656662323165303234303836653337323830346536643632373965
32306234643638393362643065633264306131656130623266656661326233386461326438313865
66613838613866313437356162386537633430636336626162353939613131636439336639383063
30643538313262386337396631333131393665323739653132633430316332626438353335383433
33613633656465386532643631383537326433373061663261303862393065313139656665623234
61613064613063303133346231663864643537313935353865316531653362623734636361393631
37323934333737396564613237323233643435366532623234323136343963663236656465326262
38613631313564306336353163646533363636396437663734396161303561373337346366353431
38636433396165373465373239393437653831646431663338303137656165316365386138336434
35363265616335363431323237383937616235633962663763623661626261356464323532313265
36393262346533313035646433333562303466346239333935393966306436623539366264333837
61383265363230616362326538333137346233303364353463326135333137366339656137333436
63303661636663333862653261623535333834313131376531316435393161653431313661643538
31343466376435623163663766663130333062326564663133353263633731376335383134663432
35656233363861373238303931616437313932613535613337376465393839653661653837663366
31653033613433313935383762633333363834633465383430656163633733383539303935363635
37303931316135353365616430343761383532306366633833653264313832656564366465643061
65316363653038366263306566633638663761643438653038363837393062653136363839323035
35356330646631346335313562383333303530356237393936323134373031313666646435303837
31366537653436386433626361396532613831653534326364333936356131643131313764636333
61663839343965363430613836353936393462623931323432623361313566363131666432393239
66373438616534643637343838316435333838363461646234343731383961633562393035613162
30316532646634386239623262663637306330616663653334356637356639313739613235633961
31306239656562653532623564626633613261663430313364393264383139386264323266326235
30633135306534333730333262316231653162636435323336636131663561643034353065623937
61326263393932303434336661363366396434633131626231306330623136623161613838636439
66343835613966646330393362396564613037653962633238326166363837666564373761376231
63653631323965653233653366623866633738386161306437666438336137336664383736613037
61313439303635353930393333653434366565303531333536333132393438306235666261666434
32646232343263356665383337666136373164326562643138326361636362313264393736396533
33383665356235346466656431633039666231623261373435303065656239383132323136396438
36353730616666393335653136383438336434653833653866616636333435633334346235353438
62616363323561666261316534356662616562316430333565353664326261373831306365306463
31616136306134366561303631316234633335643838663964646263313561383834623362633165
34643338303561636432346636346466343565343330623864333962396230633030303536613830
63616336353261363065363537383065383632636339363032636238386233316235336366363663
64376366663061663963366162353862643961653438303963663934666330326435653834663334
66623238336431363831343335636534336632656332653439626436306135313833643362326666
35646630306337643830626266323562663638646331636334613661306436336132303330323130
63643461626331346264343933326431636338616137336361343238306633663836313761613730
35323764353933323935646631356666366635323830616561353532316237646464613863326362
30373163316265363234313933613463313963313137323134613136343731666331333336643132
35326665663765653232386165653834373966383161653965376333383937353131666631636162
63653438373865356530393731663563316165313835303637376566333663636135663830636566
37396637636666393262393962326135373430326563393765323062393037366238326665326365
32633464633134633862643666323463343132663462363932313765306263333163323734646132
39306333373134666564653061303965653034396539666239646334343238653165356531326637
38386366343466626538313338316662353562306337333962636364663134333662613934376336
35666130373038663535663365663534333730656563633138363030383632323936656130646463
37316332656365326335353835643131626265303130343262393261336162333163653034356661
31643565303430346561396363636661366462623765323763633839633432326361383233353962
32616631663132373861613039303730386361613630393835623238333331363663623132366533
3333653634323466336463663436643138626531343937636131
9 changes: 7 additions & 2 deletions roles/logs/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
state: restarted

- name: Restart loki
ansible.builtin.service:
ansible.builtin.systemd:
name: loki
state: restarted
become: true
when:
- running_on_server

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

- name: Copy file with variable filename
ansible.builtin.copy:
src: "pul-gcdc-{{ runtime_env }}-account-key.json"
dest: "/etc/loki/{{ logs_gcs_credentials }}"
owner: root
group: root
mode: "0644"
when:
- running_on_server

- 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'
regexp: '^Environment="GOOGLE_APPLICATION_CREDENTIALS=/etc/loki/{{ logs_gcs_credentials }}"$'
line: 'Environment="GOOGLE_APPLICATION_CREDENTIALS=/etc/loki/{{ logs_gcs_credentials }}"'
insertafter: '^\[Service\]'
notify: Reload loki service

- name: Logs | ensure ExecReload is present in Loki service
ansible.builtin.lineinfile:
path: /etc/systemd/system/loki.service
regexp: '^ExecReload='
line: 'ExecReload=/bin/kill -HUP $MAINPID'
insertafter: '^\[Service\]'
notify: Reload loki service

- name: Logs | add loki config
Expand All @@ -39,7 +57,7 @@
dest: /etc/loki/config.yml
owner: root
group: root
mode: '0640'
mode: '0644'
notify: Restart loki

- name: Logs | add grafana ldap config
Expand Down

0 comments on commit 78c1eea

Please sign in to comment.