The following is my tasks list-
---
- name: create user
user: name={{server_user}} state=present
#TO Do: perform below task using forwarding Agent
- name: Create the Bitbucket SSH public key file
copy:
src: "~/.ssh/id_rsa.pub"
dest: "{{ home_dir }}/.ssh/id_rsa_bitbucket.pub"
mode: 0644
owner: "{{ server_user }}"
group: "{{ server_user }}"
tags:
- deploy
- name: Create the Bitbucket SSH private key file
copy:
src: "~/.ssh/id_rsa"
dest: "{{ home_dir}}/.ssh/id_rsa_bitbucket"
mode: 0660
owner: "{{ server_user }}"
group: "{{ server_user }}"
tags:
- deploy
- name: setup the git repo
git:
repo: "{{git_repo}}"
version: "{{git_branch}}"
dest: "{{repo_path}}"
accept_hostkey: yes
force: yes
key_file: "{{ home_dir}}/.ssh/id_rsa_bitbucket"
tags:
- deploy
Main.yml
# General
server_user: www-data
repo_path: /opt/apps/surbo_third_party_integrations
workspace_path: /opt/apps/
home_dir: "/home/{{ansible_user}}"
server_log: /var/log
app_log_path: /var/log/surbo_clients/app.log
debug_log_path: /var/log/surbo_clients/debug.log
# Git settings
git_repo: git@bitbucket.org:infinito-admin/surbo_third_party_integrations.git
git_branch: master
# Virtualenv settings │
virtualenv_path: /opt/.venv_surbo_clients
And the command used is
ansible-playbook -v surbo_clients.yml -i environments/uat/inventory -t deploy
However when setup the git repo task is launched it ends in an infinite loop
We wold need more debugging details to determine what can be causing this scenario.
If this problem is only happening in Ansible, I'm afraid you should try looking for help at https://www.ansible.com/community.
In case the problem happens also outside Ansible we will need to add some extra debugging to understand what is happening.you could try this prior to run your git command:
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
Ah, It just occurred to me that if Ansible is able to use the bitbucket repo with user and password, it could be some issue when approving the finger print of Bitbucket.org for example.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.