Skip to content

Commit

Permalink
improvement to how prelude handles session tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
josehelps committed Jun 22, 2022
1 parent 0a4adc3 commit af920a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ansible/roles/prelude/files/prelude-operator.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Description=Prelude Operator

[Service]
EnvironmentFile=/opt/prelude/env
ExecStart=/opt/prelude/headless --accountEmail=${ACCOUNT_EMAIL}
ExecStart=/opt/prelude/headless --accountEmail=${ACCOUNT_EMAIL} --sessionToken=${SESSION_TOKEN}
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=prelude-operator
Expand Down
12 changes: 4 additions & 8 deletions ansible/roles/prelude/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
dest: /opt/prelude
remote_src: yes

- name: Generate Session Token
shell: uuidgen
register: prelude_session_token

- name: Copy env, configures Prelude Email Account
template:
src: env
Expand All @@ -37,14 +41,6 @@
name: prelude-operator.service
state: started

- name: Get Session Token
shell: journalctl -t prelude-operator | egrep -e '[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$' -o | tail -n1
register: prelude_session_token

- name: Print Session Token
debug:
var: prelude_session_token

- name: Write Session Token to file
delegate_to: localhost
become: false
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/prelude/templates/env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Prelude Creds
ACCOUNT_EMAIL={{ prelude_account_email }}

SESSION_TOKEN= {{ prelude_session_token.stdout }}

0 comments on commit af920a7

Please sign in to comment.