Awx: AWX connection to gitlab server - error

Created on 27 Dec 2017  路  12Comments  路  Source: ansible/awx

ISSUE TYPE
  • help wanted
COMPONENT NAME
  • UI
SUMMARY

In my organization we working with gitlab server, i want to pull a project from my gitlab server,
Im creating a credetials with my gitlab username and password, I get an error:
"Could not read from remote repository, Please make sure you have the correct access rights and
the repository exist"

ENVIRONMENT
  • AWX version: newest 1.0.2.303
  • AWX install method: docker on linux
  • Ansible version: 2.4.2.0
  • Operating System: RHEL 7
  • Web Browser: Chrome / Explorer
STEPS TO REPRODUCE

I created a Credentials for gitlab with my gitlab username and password but I have a field with SCM private key, I dont know which key to take, usually need a public key but here its private

EXPECTED RESULTS

Connecting to gitlab

ACTUAL RESULTS

"Could not read from remote repository, Please make sure you have the correct access rights and
the repository exist"

ADDITIONAL INFORMATION

I searched for tutorial connecting gitlab to AWX with ssh keys but nothing found .
thanks for help .

api medium needs_info bug

All 12 comments

Hi, how did you configure SCM Url in your project?
I'm currently using an https endpoint so in my case username/password in Credential is enough and I don't need a private key.

Maybe looking at awx_task container logs may help you in troubleshooting.

@shortsteps thanks for your help,
I tried without ssh key its not working, get same error
Its connecting the server threw ssh but not to the repository .

Sorry @arikbidny if I ask you again, but how did you configure SCM Url in the "Source Details" section of your Project?
Thanks

@shortsteps
https://servername:port/groupName/projectName

I guess you also have .git at the end (something like https://github.com/ansible/ansible.git), isn't it?
Does it happen with all repos or only with that one?

@shortsteps
I tried with .git not works, It happen with all the repos ..

@abenokraitis
I'm using gitlab internally here. This is what I do that works for me

I'm using ssh authentication for my gitlab projects not https

Added "ansible" user to gitlab, make sure it has read access to projects you require.

on AWX I added SCM git credentials for ansible user. This user was already provisioned on a centos server. I copied the ~/.ssh/id_rsa to the private key in awx credentials,

I copied the ~/.ssh/id_rsa.pub public key to gitlab "ansible" user key.

project url is in the form of git@server:group/project.git

if you use https you may need to create an authentication token in gitlab. I find ssh is easier.

I see the same with 1.0.2.303. It worked fine before.

I'm using 1.0.2.303 myself and is working with ssh, looks like https is broken

You can't use ssh keys for http(s) scm authentication.

If you create an scm credential with just the username and password it doesn't work? Can you try to reproduce this using the standalone git module in ansible itself? This is what awx uses under the hood: http://docs.ansible.com/ansible/latest/git_module.html

See our project update playbook here: https://github.com/ansible/awx/blob/devel/awx/playbooks/project_update.yml

Per the documentation listed above and a discussion with @agaffney on IRC, I have come to the conclusion that one cannot authenticate to a git SCM via SSH using simply username and password SCM Credentials (ssh://[email protected]/var/www/git/myRepo.git).
An SSH key must be used (ssh://[email protected]/var/www/git/myRepo.git).

That makes sense and jives with our internal documentation.

Was this page helpful?
0 / 5 - 0 ratings