nomad/ansible/roles/git-compare-head/tasks/main.yml
2023-03-18 13:13:16 +00:00

13 lines
460 B
YAML

---
- name: Get local HEAD id
local_action: command git rev-parse HEAD
register: local_head
- name: Get remote HEAD id
local_action: command git ls-remote origin HEAD
register: remote_head
- name: Compare local and remote
fail:
msg: "Local repository is not up to date. Please pull latest changes from remote or push your local changes."
when: (local_head.stdout != (remote_head.stdout | split('\t') | first)) and ansible_check_mode == false