mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-06 09:47:38 +00:00
fix(openproject): pass admin password via env to avoid shell expansion
https://chatgpt.com/share/6974cbac-023c-800f-8198-fd85df2aa7bc
This commit is contained in:
2 files changed
+5
-4
No files matched your search
@@ -19,7 +19,7 @@ users:
|
||||
administrator:
|
||||
authorized_keys:
|
||||
- ssh-ed25519 AAAA_TEST_DUMMY_KEY github-ci-dummy@infinito
|
||||
password: "'Str0ng€xampl3PW!"
|
||||
password: "'$tr0ng€xampl3PW!"
|
||||
biber:
|
||||
username: "biber"
|
||||
full_name: "Harry Beaver"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
- name: Ensure administrator user exists and is admin
|
||||
shell: >
|
||||
{{ docker_compose_command_exec }} web bash -c "
|
||||
{{ docker_compose_command_exec }} -e OPENPROJECT_ADMIN_PASSWORD={{ OPENPROJECT_ADMINISTRATOR_PASSWORD | quote }} web bash -c "
|
||||
cd /app &&
|
||||
bundle exec rails runner \"
|
||||
pw = ENV['OPENPROJECT_ADMIN_PASSWORD']
|
||||
u = User.find_by(login: '{{ OPENPROJECT_ADMINISTRATOR_USERNAME }}')
|
||||
if u.nil?
|
||||
u = User.new(
|
||||
@@ -10,8 +11,8 @@
|
||||
mail: '{{ OPENPROJECT_ADMINISTRATOR_EMAIL }}',
|
||||
firstname: 'Admin',
|
||||
lastname: 'User',
|
||||
password: '{{ OPENPROJECT_ADMINISTRATOR_PASSWORD }}',
|
||||
password_confirmation: '{{ OPENPROJECT_ADMINISTRATOR_PASSWORD }}'
|
||||
password: pw,
|
||||
password_confirmation: pw
|
||||
)
|
||||
u.admin = true
|
||||
u.save!
|
||||
|
||||
Reference in new issue
Block a user