Updated to create project for gitlab and share with group
diff --git a/private-gitlab-repository-create-update.yml b/private-gitlab-repository-create-update.yml index 05bdb41..266bef1 100644 --- a/private-gitlab-repository-create-update.yml +++ b/private-gitlab-repository-create-update.yml
@@ -8,23 +8,28 @@ - private-repository-user-list.yml tasks: - name: Create Gitlab repositories if necessary + tags: ['create'] + register: repos uri: - url: "{{ repository_secure_endpoint_https }}" + url: "{{ repository_secure_endpoint_https }}?name={{ item }}" method: POST - user: "{{ username }}" - password: "{{ password }}" - force_basic_auth: yes + headers: + PRIVATE-TOKEN: "{{ private_token }}" status_code: 201,409 - body_format: json - body: - name: "{{ item.repo_name }}" - scmId: git - forkable: True with_items: - "{{ config_repos }}" - "{{ playbook_repos }}" - "{{ role_repos }}" + - name: Share repos with group + tags: ['create'] + uri: + url: "{{ repository_secure_endpoint_https }}/projects/{{ repos.json.id }}/share" + method: POST + headers: + PRIVATE-TOKEN: "{{ private_token }}" + status_code: 201,409 + - name: Add permissions to Bitbucket repositories uri: url: "{{ repository_secure_endpoint_https }}/permissions/users?name={{ item }}&permission=PROJECT_ADMIN"