Move add user task to an import_tasks task so that we can actually notify it, use systemd daemon reloads in a copuple places
This commit is contained in:
parent
ab51654a1b
commit
21d3d8c410
@ -2,35 +2,9 @@
|
||||
# vim:ft=ansible:
|
||||
---
|
||||
- name: restart gitea
|
||||
service:
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: gitea.service
|
||||
state: restarted
|
||||
- name: gitea add default user
|
||||
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
|
||||
command:
|
||||
argv:
|
||||
- /usr/bin/mysql
|
||||
- gitea
|
||||
- -u
|
||||
- gitea
|
||||
- -p
|
||||
- "{{ gitea_mysql_password }}"
|
||||
- -e
|
||||
- 'UPDATE user SET is_admin = 1 WHERE name = {{ gitea_admin_username }};'
|
||||
become: yes
|
||||
become_user: git
|
||||
import_tasks: tasks/add_default_user.yml
|
||||
|
33
roles/gitea/tasks/add_default_user.yml
Normal file
33
roles/gitea/tasks/add_default_user.yml
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
#!/usr/bin/ansible-playbook
|
||||
# vim:ft=ansible:
|
||||
---
|
||||
- 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
|
||||
become: yes
|
||||
become_user: git
|
||||
- name: Promote user to admin
|
||||
command:
|
||||
argv:
|
||||
- /usr/bin/mysql
|
||||
- gitea
|
||||
- -u
|
||||
- gitea
|
||||
- -p
|
||||
- "{{ gitea_mysql_password }}"
|
||||
- -e
|
||||
- 'UPDATE user SET is_admin = 1 WHERE name = {{ gitea_admin_username }};'
|
||||
become: yes
|
||||
become_user: git
|
@ -108,7 +108,8 @@
|
||||
dest: "/etc/systemd/system/gitea.service"
|
||||
notify: restart gitea
|
||||
- name: Start and enable service
|
||||
service:
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: "gitea.service"
|
||||
enabled: yes
|
||||
state: "started"
|
||||
|
Loading…
Reference in New Issue
Block a user