Add Gitea default user if and only if we don't have any users
This commit is contained in:
parent
9553987cc7
commit
aa11c3378b
@ -49,6 +49,7 @@
|
||||
url: "https://dl.gitea.io/gitea/1.11.4/gitea-1.11.4-linux-amd64"
|
||||
dest: "/usr/local/bin/gitea"
|
||||
mode: "0755"
|
||||
notify: restart gitea
|
||||
- name: Create Gitea user
|
||||
user:
|
||||
name: git
|
||||
@ -93,8 +94,18 @@
|
||||
mode: "0640"
|
||||
owner: "root"
|
||||
group: "git"
|
||||
notify: gitea add default user
|
||||
when: not p.stat.exists
|
||||
- name: Check for default user
|
||||
mysql_query:
|
||||
login_user: gitea
|
||||
login_password: "{{ gitea_mysql_password }}"
|
||||
query: "SELECT NAME FROM USER WHERE NAME = \"{{ gitea_admin_username }}\";"
|
||||
register: q
|
||||
- name: Queue up default user addition
|
||||
debug:
|
||||
msg: "User not found"
|
||||
notify: gitea add default user
|
||||
when: not q.changed
|
||||
- name: Template out service
|
||||
template:
|
||||
src: "gitea.service"
|
||||
|
Loading…
Reference in New Issue
Block a user