Open gforster opened 4 years ago
We make a copy of the repo for playbook execution; it may not be able to be treated as a live repo.
What automation decisions/tasks are you using this information to inform?
In doing a server build, I need to create a set of local facts, the most important being the version of the build, which is equal to the git tag. This allows me to treat servers appropriately based on the version of the Ansible playbook that provisioned them. This works wonderfully well in Ansible engine.
Sent with GitHawk
Hey @gforster,
I'm guessing the way that AWX copies the repo for playbook execution probably isn't persisting tags. Would something like git rev-parse --short HEAD
meet your needs, or do you actually need the git tag?
ISSUE TYPE
SUMMARY
git commands for currently used repo are unavailable. Unable to run
git describe
on localhost for current running templateENVIRONMENT
STEPS TO REPRODUCE
Run the following tasks:
name: get last git tag command: git describe delegate_to: localhost register: output
debug: msg="{{ output }}"
EXPECTED RESULTS
v1.3.0-5-5c1f940
ACTUAL RESULTS
TASK get last git tag] *** fatal: [my-test-host -> localhost]: FAILED! => {"changed": true, "cmd": ["git", "describe"], "delta": "0:00:00.010565", "end": "2020-05-06 17:34:22.161630", "msg": "non-zero return code", "rc": 128, "start": "2020-05-06 17:34:22.151065", "stderr": "fatal: No names found, cannot describe anything.", "stderr_lines": ["fatal: No names found, cannot describe anything."], "stdout": "", "stdout_lines": []}
ADDITIONAL INFORMATION