Skip to content

Commit 8381a64

Browse files
committed
fix: pem indent
1 parent 0e6811c commit 8381a64

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

ansible/group_vars/vps.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ namespace: ai-bot
2424
# NEVER commit real values here.
2525
github_app_id: "CHANGE_ME"
2626
github_private_key_path: "/path/to/github-app.pem"
27+
github_private_key_local_path: "/path/to/github-app.pem"
2728
webhook_secret: "CHANGE_ME"
2829
admin_token: "CHANGE_ME"
2930

ansible/playbook.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,23 +148,24 @@
148148
register: apply_network_policies
149149
changed_when: "'created' in apply_network_policies.stdout or 'configured' in apply_network_policies.stdout"
150150

151+
- name: Copy GitHub App private key to remote
152+
ansible.builtin.copy:
153+
src: "{{ github_private_key_local_path }}"
154+
dest: /tmp/github-app.pem
155+
mode: "0600"
156+
151157
- name: Apply github-app secret
152-
ansible.builtin.command:
153-
cmd: k3s kubectl apply -f -
154-
stdin: |
155-
apiVersion: v1
156-
kind: Secret
157-
metadata:
158-
name: github-app
159-
namespace: {{ namespace }}
160-
type: Opaque
161-
stringData:
162-
GITHUB_APP_ID: "{{ github_app_id }}"
163-
GITHUB_PRIVATE_KEY: |
164-
{{ lookup('ansible.builtin.file', github_private_key_path) | indent(14, false) }}
165-
register: apply_secret_github_app
166-
changed_when: "'created' in apply_secret_github_app.stdout or 'configured' in apply_secret_github_app.stdout"
167-
# no_log: true
158+
ansible.builtin.shell: |
159+
k3s kubectl -n {{ namespace }} delete secret github-app --ignore-not-found
160+
k3s kubectl -n {{ namespace }} create secret generic github-app \
161+
--from-literal=GITHUB_APP_ID={{ github_app_id }} \
162+
--from-file=GITHUB_PRIVATE_KEY=/tmp/github-app.pem
163+
no_log: true
164+
165+
- name: Remove temporary key file
166+
ansible.builtin.file:
167+
path: /tmp/github-app.pem
168+
state: absent
168169

169170
- name: Apply github-webhook-secret
170171
ansible.builtin.command:

0 commit comments

Comments
 (0)