Closed srikanthgl closed 1 year ago
This playbook works fine:
- name: Test git
hosts: localhost
connection: local
tasks:
- name: Git checkout
ansible.builtin.git:
repo: 'https://github.com/tfutils/tfenv'
dest: /tmp/tfenv
version: v2.0.0
ansible-playbook --version
ansible-playbook [core 2.12.6]
config file = None
configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/homebrew/lib/python3.10/site-packages/ansible
ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections
executable location = /opt/homebrew/bin/ansible-playbook
python version = 3.10.5 (main, Jun 23 2022, 17:14:57) [Clang 13.1.6 (clang-1316.0.21.2.5)]
jinja version = 3.0.1
libyaml = False
The problem is not tfenv-related. I suggest checking if your git version is up-to-date.
Hi @d-mankowski-synerise We are running this ansible playbook in the packer provisioners, and the playbook has git installed with yum module. This confirms git is of up-to-date. May I get any other resolutions please..
@srikanthgl this does not confirm that git is up-to-date, because git installed from yum is like really, really old, unless you add some 3rd party yum repository (or build git from source). Refer to this article (and just execute git --version
on a server, the up-to-date version is 2.37):
https://developpaper.com/centos-uses-yum-to-upgrade-git-to-the-latest-version-of-2-1x/
You can only install up to 1.8 using yum
@d-mankowski-synerise
I can say that the packer is installing the latest version of git 2.37.1 from amazon2.core repository.
Please find the attached screenshot.
This is nonetheless not a tfenv related problem. This is a problem in using ansible and git. The tfenv repo is not unusual in any regard, and I would expect your problem to be reproducable with any github repository, not just tfenv.
while trying to download the tfenv by ansible playbook, getting the below error. Could you please help me out @Zordrak
amazon-ebs: fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": "/bin/git ls-remote origin -h refs/heads/v2.0.0", "msg": "fatal: 'origin' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.", "rc": 128, "stderr": "fatal: 'origin' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n", "stderr_lines": ["fatal: 'origin' does not appear to be a git repository", "fatal: Could not read from remote repository.", "", "Please make sure you have the correct access rights", "and the repository exists."], "stdout": "", "stdout_lines": []}
Attached are the ansible playbook and the jenkins job output for reference.