tfutils / tfenv

Terraform version manager
MIT License
4.43k stars 450 forks source link

Error while downloading tfenv by ansible playbook #352

Closed srikanthgl closed 1 year ago

srikanthgl commented 2 years ago

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.

Screenshot 2022-07-22 at 5 46 14 PM Screenshot 2022-07-22 at 5 44 40 PM
d-mankowski-synerise commented 2 years 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.

srikanthgl commented 1 year ago

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..

d-mankowski-synerise commented 1 year ago

@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
srikanthgl commented 1 year ago

@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.

Screenshot 2022-07-25 at 8 38 54 PM
Zordrak commented 1 year ago

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.