infra-ansible/roles/deploy_system_config/tasks/clone_system_config_locally...

24 lines
791 B
YAML

---
# Clone system-config locally in the command machine
- git: repo="{{ system_config_repo_url }}"
dest=/tmp/infra-ansible/system-config/production
version=master
accept_hostkey=True
force=True
tags: clone_system_config_locally
- command: git symbolic-ref --short -q HEAD
args:
chdir: /tmp/infra-ansible/system-config/production
register: checked_out_branch
- command: git show-ref --verify --quiet "{{ system_config_branch }}"
register: system_config_branch_exists
ignore_errors: True
- command: git checkout -b "{{ system_config_branch }}"
when: system_config_branch_exists|failed
- command: git checkout "{{ system_config_branch }}"
when: system_config_branch_exists|success and checked_out_branch.stdout != "{{ system_config_branch }}"