mirror of
https://github.com/luzifer-ansible/deploy-git.git
synced 2024-11-08 13:20:01 +00:00
Use includes to bundle tasks
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
a58780d86b
commit
3edef4fb6a
2 changed files with 26 additions and 22 deletions
24
tasks/act.yaml
Normal file
24
tasks/act.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
|
||||
- name: Execute pre-commands
|
||||
command: '{{ item.pre_command.command }}'
|
||||
args:
|
||||
chdir: '{{ item.pre_command.chdir | default(item.dest) }}'
|
||||
when: '{{ item.pre_command is defined }}'
|
||||
|
||||
- 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) }}'
|
||||
when: '{{ item.post_command is defined and git_checkout.changed }}'
|
||||
|
||||
...
|
|
@ -1,26 +1,6 @@
|
|||
---
|
||||
|
||||
- name: Execute pre-commands
|
||||
command: '{{ item.pre_command.command }}'
|
||||
args:
|
||||
chdir: '{{ item.pre_command.chdir | default(item.dest) }}'
|
||||
with_items: '{{ git_checkouts }}'
|
||||
when: '{{ item.pre_command is defined }}'
|
||||
|
||||
- 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") }}'
|
||||
with_items: '{{ git_checkouts }}'
|
||||
|
||||
- name: Execute post-commands
|
||||
command: '{{ item.post_command.command }}'
|
||||
args:
|
||||
chdir: '{{ item.post_command.chdir | default(item.dest) }}'
|
||||
with_items: '{{ git_checkouts }}'
|
||||
when: '{{ item.post_command is defined }}'
|
||||
- include_tasks: act.yaml
|
||||
with_items: {{ git_checkouts }}
|
||||
|
||||
...
|
||||
|
|
Loading…
Reference in a new issue