Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to create users in Gitea #155

Open
ericzolf opened this issue Mar 25, 2024 · 1 comment
Open

Add capability to create users in Gitea #155

ericzolf opened this issue Mar 25, 2024 · 1 comment

Comments

@ericzolf
Copy link

ericzolf commented Mar 25, 2024

Something like the following could be added to the role:

- name: Use gitea cli to create user
  ansible.builtin.command: >
    /usr/local/bin/gitea -c {{ gitea_configuration_path }}/gitea.ini admin user create
    --username "{{ item.name }}"
    --password "{{ item.password }}"
    --email "{{ item.email }}"
    --must-change-password=false
  become_user: "{{ gitea_user }}"
  register: gitearesult
  failed_when:
    - '"successfully created" not in gitearesult.stdout'
    - '"user already exists" not in gitearesult.stderr'
  changed_when:
    - '"successfully created" in gitearesult.stdout'
  loop: "{{ gitea_users }}"

With defaults/main.yml looking like:

# list of users to add to Gitea, default is an empty list so that no user is created
gitea_users: []
# example of entry
#  - name: johndoe
#    password: verysecret
#    email: "johndoe@{{ gitea_fqdn }}"
@DO1JLR
Copy link
Member

DO1JLR commented Mar 25, 2024

yes, good idea.

DO1JLR added a commit that referenced this issue Mar 25, 2024
+ Creating local users
+ modify file permissions
Inspired by #155
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants