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 name: gitea.service
state: restarted state: restarted
- name: gitea add default user - name: gitea add default user
command: block:
argv: name: Create user
- /usr/local/bin/gitea command:
- admin argv:
- create-user - /usr/local/bin/gitea
- --username - admin
- "{{ gitea_admin_username }}" - create-user
- --password - --username
- "{{ gitea_admin_password }}" - "{{ gitea_admin_username }}"
- --email - --password
- "{{ gitea_admin_email }}" - "{{ gitea_admin_password }}"
- --config - --email
- /etc/gitea/app.ini - "{{ 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: yes
become_user: git become_user: git

View File

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