First commit
This commit is contained in:
commit
e54b5a5663
24 changed files with 3047 additions and 0 deletions
29
roles/jenkins-php-v1/tasks/30_users.yml
Normal file
29
roles/jenkins-php-v1/tasks/30_users.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
|
||||
- name: Check if Gitea user has already been created
|
||||
stat:
|
||||
path: "{{ jenkins_gitea_password_file }}"
|
||||
register: result
|
||||
|
||||
- name: Do we have to create the Gitea user
|
||||
set_fact:
|
||||
createGiteaUser: "{{ result.stat.exists is undefined or result.stat.exists == False }}"
|
||||
|
||||
- name: Generate a password for the Gitea user
|
||||
set_fact:
|
||||
giteaPassword: "{{ lookup('password', '/dev/null chars=ascii_letters') }}"
|
||||
when: createGiteaUser
|
||||
|
||||
- name: Create Gitea user
|
||||
shell: echo 'jenkins.model.Jenkins.instance.securityRealm.createAccount("gitea", "{{ giteaPassword | quote }}")' | "{{ jenkins_cli_command }}" groovy =
|
||||
when: createGiteaUser
|
||||
|
||||
- name: Upload the new password
|
||||
copy:
|
||||
content: "{{ giteaPassword }}"
|
||||
dest: "{{ jenkins_gitea_password_file }}"
|
||||
owner: jenkins
|
||||
group: jenkins
|
||||
mode: 0600
|
||||
when: createGiteaUser
|
||||
#no_log: yes # FIXME: actually, we want to know it to tell the user to set a URL with it in Gitea. Add a debug msg maybe ?
|
Reference in a new issue