Skip to content

Commit 37f5da7

Browse files
committed
Allow nested use in molecule prepare of other roles with loop_var
1 parent c8c72e1 commit 37f5da7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,6 @@
267267
- name: Disable weak host keys
268268
include_tasks: weak_keys.yml
269269
loop: "{{ weak_host_keys }}"
270+
loop_control:
271+
loop_var: the_key
270272
...

tasks/weak_keys.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
- name: "Check weak key presence for {{ item }}"
2+
- name: "Check weak key presence for {{ the_key }}"
33
stat:
4-
path: "/etc/ssh/{{ item }}"
4+
path: "/etc/ssh/{{ the_key }}"
55
register:
66
weak_key_found
77

8-
- name: "Disable weak host key {{ item }}"
8+
- name: "Disable weak host key {{ the_key }}"
99
when:
1010
- weak_key_found.stat.exists is defined
1111
- weak_key_found.stat.exists|bool
1212
file:
13-
path: "/etc/ssh/{{ item }}"
13+
path: "/etc/ssh/{{ the_key }}"
1414
mode: 0666
1515
...

0 commit comments

Comments
 (0)