Use MySQL query to promote new user to admin

Because that doesn't happen by default
This commit is contained in:
Salt 2020-04-30 07:56:36 -05:00
parent bd38470bde
commit 0d8f6f4a97
2 changed files with 24 additions and 13 deletions

View File

@ -6,18 +6,28 @@
name: gitea.service
state: restarted
- name: gitea add default user
command:
argv:
- /usr/local/bin/gitea
- admin
- create-user
- --username
- "{{ gitea_admin_username }}"
- --password
- "{{ gitea_admin_password }}"
- --email
- "{{ gitea_admin_email }}"
- --config
- /etc/gitea/app.ini
block:
name: Create user
command:
argv:
- /usr/local/bin/gitea
- admin
- create-user
- --username
- "{{ gitea_admin_username }}"
- --password
- "{{ gitea_admin_password }}"
- --email
- "{{ gitea_admin_email }}"
- --config
- /etc/gitea/app.ini
name: Promote user to admin
mysql_query:
login_db: gitea
login_user: gitea
login_password: {{ gitea_mysql_password }}
query: UPDATE user SET is_admin = 1 WHERE name = %s
positional_args:
- "{{ gitea_admin_username }}"
become: yes
become_user: git

View File

@ -10,6 +10,7 @@
packages:
- mariadb-server
- python3-mysqldb
- python3-pymysql
- name: Start MySQL
service:
name: mysql