Skip to content

Commit

Permalink
Correct admin password updating
Browse files Browse the repository at this point in the history
Corrects an issue with admin passwords failing to be updated due to shell escaping.  This aligns the operator with the logic in the normal installer.
  • Loading branch information
dhageman committed Jan 6, 2023
1 parent a199a8c commit 9b82f18
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions roles/installer/tasks/initialize_django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: >-
bash -c "echo \"from django.contrib.auth.models import User;
User.objects.create_superuser('{{ admin_user }}', '{{ admin_email }}', '{{ admin_password }}')\"
| awx-manage shell"
command: awx-manage createsuperuser --username={{ admin_user | quote }} --email={{ admin_email | quote }} --noinput
register: result
changed_when: "'That username is already taken' not in result.stderr"
failed_when: "'That username is already taken' not in result.stderr and 'Superuser created successfully' not in result.stdout"
no_log: "{{ no_log }}"
when: users_result.return_code > 0

- name: Update Django super user password
k8s_exec:
namespace: "{{ ansible_operator_meta.namespace }}"
pod: "{{ tower_pod_name }}"
container: "{{ ansible_operator_meta.name }}-task"
command: awx-manage update_password --username='{{ admin_user }}'' --password='{{ admin_password }}' --noinput
regiser: result
changed_when: "'Password updated' in result.stdout"
no_log: "{{ no_log }}"
when: users_result.return_code > 0

Expand Down

0 comments on commit 9b82f18

Please sign in to comment.