diff --git a/update/ansible/playbook/tasks/roles/initialization/tasks/main.yml b/update/ansible/playbook/tasks/roles/initialization/tasks/main.yml index 2476b13d68..aa7cf1267b 100644 --- a/update/ansible/playbook/tasks/roles/initialization/tasks/main.yml +++ b/update/ansible/playbook/tasks/roles/initialization/tasks/main.yml @@ -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: @@ -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 + 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" diff --git a/update/ansible/playbook/tasks/update.yml b/update/ansible/playbook/tasks/update.yml index 61ae3a43a2..a4ebee9290 100644 --- a/update/ansible/playbook/tasks/update.yml +++ b/update/ansible/playbook/tasks/update.yml @@ -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: