2

I have been successful configuring Ansible Tower project to pull from remote git repos, and also pulling from a local repo using ssh and stored credentials (keys). On this server, allowing ssh login to access git is not acceptable, so I am trying to configure Ansible Tower to use a local git repository; not using git: or ssh: protocol to access, just accessing it via file:///path/to/AnsibleTower.git

The Ansible Tower project-update function tries to 'git clone', but it gives an error:

        "fatal: Could not read from remote repository.",
        "Please make sure you have the correct access rights",
        "and the repository exists."

And it shows this is the command it used to attempt to clone:

"cmd": "/usr/bin/git clone --origin origin file:///path/to/AnsibleTower.git/ /var/lib/awx/projects/_114__00_test"

When I execute the above command directly on the server, as the awx user, I get no error and the clone works. I can see that the git commands is being executed with the awx user when Tower attempts to update (watching ps for the process). The awx user owns the AnsibleTower.git directory and everything in it.

The reason this is important and the reason I have tagged this 'ansible-inventory' is that using an SCM-backed project seems to be the only way to import/synchronize a text-based inventory to Tower. I would really like to avoid re-creating/updating my inventory using the Tower web interface; I want that tracked in SCM as well.

I even went so far as to grant all users access to the .git directory (temporarily); that didn't work either, it doesn't seem to be a user-permission issue.

Wolske
  • 146
  • 2
  • 7

2 Answers2

1

Ansible Tower is only able to locally access playbooks and associated files from /var/lib/awx/projects.

If the repo is presented as a file folder, you can link from /var/lib/awx/projects to the repo like this:

ln -s /my/great/repo /var/lib/awx/projects/repo
U880D
  • 8,601
  • 6
  • 24
  • 40
Danby
  • 23
  • 3
0

You can omit the file:// at the begin of the origin. All local repositories do not need this and some OS cannot handle file:// uri‘s for local files/directories

holle2de
  • 46
  • 3