Hi I want to execute the following as ansible task to pull the latest commit id on local:
- name: get latest git commit id
local_action: "command git rev-parse HEAD"
register: git_commit_id
but I'm getting a warning because I'm using command
. Since git
is an ansible core module: http://docs.ansible.com/ansible/git_module.html
How can I execute this using git module?
If you put this in your vars file:
base: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}"
and then use the variable {{base}}
in your playbook that should do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With