2018-03-19 13:54:50 +00:00
|
|
|
---
|
|
|
|
|
2018-03-19 14:52:33 +00:00
|
|
|
- name: Generate deployment SSH key if not available
|
|
|
|
command: 'ssh-keygen -b 256 -t ed25519 -q -N "" -f "{{ item.key_file }}" -C "Ansible generated deployment key for {{ item.repo }}"'
|
|
|
|
args:
|
|
|
|
creates: '{{ item.key_file }}'
|
|
|
|
when: deploy_git_keygen and item.key_file is defined
|
|
|
|
|
2018-03-19 13:54:50 +00:00
|
|
|
- name: Execute pre-commands
|
|
|
|
command: '{{ item.pre_command.command }}'
|
|
|
|
args:
|
|
|
|
chdir: '{{ item.pre_command.chdir | default(item.dest) }}'
|
2018-03-19 13:57:45 +00:00
|
|
|
when: item.pre_command is defined
|
2018-03-19 13:54:50 +00:00
|
|
|
|
|
|
|
- name: Checkout git repo
|
|
|
|
git:
|
|
|
|
repo: '{{ item.repo }}'
|
|
|
|
dest: '{{ item.dest }}'
|
|
|
|
force: 'yes'
|
|
|
|
key_file: '{{ item.key_file | default(omit) }}'
|
|
|
|
version: '{{ item.version | default("HEAD") }}'
|
|
|
|
register: git_checkout
|
|
|
|
|
|
|
|
- name: Execute post-commands
|
|
|
|
command: '{{ item.post_command.command }}'
|
|
|
|
args:
|
|
|
|
chdir: '{{ item.post_command.chdir | default(item.dest) }}'
|
2018-03-19 13:57:45 +00:00
|
|
|
when: item.post_command is defined and git_checkout.changed
|
2018-03-19 13:54:50 +00:00
|
|
|
|
|
|
|
...
|