-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.yml
53 lines (49 loc) · 1.62 KB
/
tasks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
# https://github.com/toydarian/ansible-dependency-manager
- name: ensure roles-directory exists
file:
path: "{{ role_deps.roles_dir | default('roles/') }}"
state: directory
tags:
- always
- role_deps
- name: ensure roles are up-2-date
git:
dest: "roles/{{ item.name }}"
repo: "{{ item.repo | default(role_deps.default_role_loc + item.name + '.git') }}"
force: no
accept_hostkey: "{{ item.accept_hostkey | default(role_deps.accept_hostkey) | default('no') }}"
version: "{{ item.version | default('master') }}"
loop: "{{ role_deps.roles }}"
register: role_pulls
failed_when:
- role_pulls.failed
- not (role_deps.allow_local_modifications | default('false') | bool) or role_pulls.msg != "Local modifications exist in repository (force=no)."
tags:
- always
- role_deps
- name: fail if roles changed
fail:
msg: "Failing, as some roles changed and `role_deps.fail_when_changed` is `true`."
when:
- role_pulls.changed
- role_deps.fail_when_changed | default('false') | bool
tags:
- always
- role_deps
- name: check for local modifications
block:
- set_fact:
local_mods: "{{ local_mods | default('') }} {{ item.item.name }}"
loop: "{{ role_pulls.results }}"
no_log: true
when:
- '"msg" in item'
- not item.msg != "Local modifications exist in repository (force=no)."
- debug:
msg: "There are local modifications in the following repos:{{ local_mods }}"
when: (local_mods | default('')) != ""
when: role_deps.allow_local_modifications | default('false') | bool
tags:
- always
- role_deps