Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-12576 Change admin ID on update. #2531

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@
- name: Create empty configuration file for VictoriaMetrics
file: path=/etc/victoriametrics-promscrape.yml state=touch owner=pmm group=pmm

- name: Run SQLite -> Postgres only for docker upgrade
- name: Run operations for docker-way upgrade
block:
- name: Check that the SQLite grafana database exists
stat:
path: /srv/grafana/grafana.db
register: is_database_sqlite

- name: Temporary change database to SQLite
- name: Run SQLite -> Postgres only
block:
- name: Remove database options (SQLite is default)
ini_file:
Expand Down Expand Up @@ -160,6 +160,12 @@
- skip_ansible_lint # '503 Tasks that run when changed should likely be handlers'.
when: is_database_sqlite.stat.exists

- name: Change default admin id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need it here since the same will run on each container start in update/ansible/playbook/tasks/update.yml.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it shouldn't, because there are when condition for the whole block and update.yml doesn't work for docker-way upgrade.

postgresql_query:
db: grafana
query: UPDATE "user" SET id='1' WHERE login='admin';
when: not ansible_check_mode

- name: Wait for PMM to be ready
ansible.builtin.uri:
url: "http://127.0.0.1:7772/v1/readyz"
Expand Down
6 changes: 6 additions & 0 deletions update/ansible/playbook/tasks/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,12 @@
- ALTER TABLE api_key ALTER COLUMN name TYPE text;
when: not ansible_check_mode

- name: Change default admin id
postgresql_query:
db: grafana
query: UPDATE "user" SET id='1' WHERE login='admin';
when: not ansible_check_mode

# we need to put this step as one of the last steps, because it removes pmm.ini and /etc/alertmanager.yml
- name: Remove old or redundant packages
yum:
Expand Down
Loading