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 a6ba83b..cbd389c 100644 --- a/private-gitlab-repository-create-update.yml +++ b/private-gitlab-repository-create-update.yml
@@ -1,7 +1,10 @@ --- -- name: Create and update repositories in BitBucket +- name: Create and update repositories in Gitlab hosts: localhost connection: local + vars: + github_endpoint_https: "https://github.com/carlosfrias" + vars_files: - repository-mapping-name-folder.yml - repository-custom-properties.yml @@ -20,46 +23,37 @@ body: namespace_id: 369 with_items: - - Delete-ME -# - "{{ config_repos }}" -# - "{{ playbook_repos }}" -# - "{{ role_repos }}" + - "{{ config_repos }}" + - "{{ playbook_repos }}" + - "{{ role_repos }}" - - name: Show repos structure - tags: ['create'] - debug: - var: repos -# -# - name: Pause to show debug output -# tags: ['create'] -# pause: - - - name: Add permissions to Bitbucket repositories - uri: - url: "{{ repository_secure_endpoint_https }}/permissions/users?name={{ item }}&permission=PROJECT_ADMIN" - method: PUT - user: "{{ username }}" - password: "{{ password }}" - force_basic_auth: yes - status_code: 204,409 - with_items: "{{ repo_users }}" + - name: Git checkout of configuration repositories + become: false + git: + repo: '{{ github_endpoint_https }}/{{ item.repo_name }}.git' + dest: "{{ item.workspace }}/{{ item.repo_name }}" + accept_hostkey: yes + with_items: + - "{{ config_repos }}" + - "{{ playbook_repos }}" + - "{{ role_repos }}" - name: Add second git host as remote repo ignore_errors: true - shell: "git remote add target {{ repository_secure_endpoint_ssh }}/{{ item.repo_name }}.git" + shell: "git remote add gitlab {{ repository_secure_endpoint_ssh }}/{{ item.repo_name }}.git" args: chdir: "{{ item.workspace }}/{{ item.repo_name }}" with_items: "{{ repo_names }}" - name: Pull from second git host if the repo is already there ignore_errors: yes - shell: "git pull target master" + shell: "git pull gitlab master" args: chdir: "{{ item.workspace }}/{{ item.repo_name }}" with_items: "{{ repo_names }}" - name: Commit updated repos to second git host - shell: "git checkout master && git push -u target master" + shell: "git checkout master && git push -u gitlab master" args: chdir: "{{ item.workspace }}/{{ item.repo_name }}" with_items: "{{ repo_names }}"