-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
24 lines (21 loc) · 1 KB
/
main.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
---
# Copyright (c) 2020-2022 Jakob Meng, <jakobmeng@web.de>
# vim:set fileformat=unix tabstop=2 shiftwidth=2 expandtab:
# kate: end-of-line unix; space-indent on; indent-width 2; remove-trailing-spaces modified;
- name: Verify task definitions specified in cloudinit_config variable
when: item is not mapping or (item.keys() | difference(['when'])) | list | length != 1
ansible.builtin.fail:
msg: >-
Unsupported keyword or multiple module definitions found:
{{ (item.keys() | difference(['when'])) | join(', ') }}.
loop: '{{ cloudinit_config | default([]) }}'
- name: Run tasks specified in cloudinit_config variable
jm1.ansible.execute_module:
name: "{{ (item.keys() | difference(['when'])) | first }}"
args: "{{ item[(item.keys() | difference(['when'])) | first] }}"
when: "{{ item['when'] | default(omit) }}"
loop: "{{ cloudinit_config | default([]) }}"
notify:
- 'Apply cloud-init configuration'
- name: Apply cloud-init configuration now
ansible.builtin.meta: flush_handlers