Add creation of admin users
This commit is contained in:
parent
50924deae1
commit
a5561ea227
2 changed files with 32 additions and 2 deletions
|
@ -5,11 +5,18 @@ gotosocial_base_dir: /opt/gotosocial
|
||||||
|
|
||||||
# gotosocial_hostname: gts.example.com
|
# gotosocial_hostname: gts.example.com
|
||||||
|
|
||||||
gotosocial_version: "0.12.0-rc2"
|
gotosocial_version: "0.12.0"
|
||||||
gotosocial_release_url: https://github.com/superseriousbusiness/gotosocial/releases/download/v{{ gotosocial_version }}/gotosocial_{{ gotosocial_version }}_linux_amd64.tar.gz
|
gotosocial_release_url: |
|
||||||
|
https://github.com/superseriousbusiness/gotosocial/releases/download/v{{ gotosocial_version }}/gotosocial_{{ gotosocial_version }}_linux_amd64.tar.gz
|
||||||
|
|
||||||
gotosocial_letsencrypt_enabled: false
|
gotosocial_letsencrypt_enabled: false
|
||||||
# gotosocial_letsencrypt_email: admin@example.com # required if letsencrypt is enabled
|
# gotosocial_letsencrypt_email: admin@example.com # required if letsencrypt is enabled
|
||||||
#
|
#
|
||||||
gotosocial_http_port: 80
|
gotosocial_http_port: 80
|
||||||
gotosocial_https_port: 443
|
gotosocial_https_port: 443
|
||||||
|
|
||||||
|
gotosocial_admin_users: []
|
||||||
|
# gotosocial_admin_users:
|
||||||
|
# - name: username
|
||||||
|
# - email: example@example.com
|
||||||
|
# - password: SECRET
|
||||||
|
|
|
@ -65,3 +65,26 @@
|
||||||
name: gotosocial.service
|
name: gotosocial.service
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
- name: Create gotosocial users
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
{{ gotosocial_base_dir }}/gotosocial --config-path {{ gotosocial_base_dir }}/config.yaml \
|
||||||
|
admin account create --username {{ user.name }} --email {{ user.email }} --password {{ user.password }} > /dev/null
|
||||||
|
loop: "{{ gotosocial_admin_users | list }}"
|
||||||
|
register: gotosocial_user_creation
|
||||||
|
changed_when: gotosocial_user_creation.rc == 0
|
||||||
|
failed_when: gotosocial_user_creation.rc != 0 and not 'is already in use' in gotosocial_user_creation.stderr
|
||||||
|
loop_control:
|
||||||
|
loop_var: user
|
||||||
|
label: "{{ user.name }}"
|
||||||
|
|
||||||
|
- name: Set admin rights for gotosocial admin users
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
{{ gotosocial_base_dir }}/gotosocial --config-path {{ gotosocial_base_dir }}/config.yaml \
|
||||||
|
admin account promote --username {{ user.name }}
|
||||||
|
loop: "{{ gotosocial_admin_users | list }}"
|
||||||
|
register: gotosocial_admin_promotion
|
||||||
|
changed_when: gotosocial_admin_promotion.rc == 0
|
||||||
|
loop_control:
|
||||||
|
loop_var: user
|
||||||
|
label: "{{ user.name }}"
|
||||||
|
|
Loading…
Reference in a new issue