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"
|
url: "https://dl.gitea.io/gitea/1.11.4/gitea-1.11.4-linux-amd64"
|
||||||
dest: "/usr/local/bin/gitea"
|
dest: "/usr/local/bin/gitea"
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
notify: restart gitea
|
||||||
- name: Create Gitea user
|
- name: Create Gitea user
|
||||||
user:
|
user:
|
||||||
name: git
|
name: git
|
||||||
@ -93,8 +94,18 @@
|
|||||||
mode: "0640"
|
mode: "0640"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "git"
|
group: "git"
|
||||||
notify: gitea add default user
|
|
||||||
when: not p.stat.exists
|
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
|
- name: Template out service
|
||||||
template:
|
template:
|
||||||
src: "gitea.service"
|
src: "gitea.service"
|
||||||
|
Loading…
Reference in New Issue
Block a user