|
1 | 1 | # Standards: 0.2
|
2 | 2 | ---
|
3 |
| -- name: Create predefined containers |
4 |
| - community.general.proxmox: |
5 |
| - api_user: "{{ api_user }}" |
6 |
| - api_password: "{{ api_password }}" |
7 |
| - api_host: "{{ proxmox_defaults.api_host }}" |
8 |
| - vmid: "{{ item.proxmox_config.vmid }}" |
9 |
| - hostname: "{{ item.proxmox_config.hostname }}" |
10 |
| - template: "{{ item.proxmox_config.ostemplate }}" |
11 |
| - netif: "{{ item.proxmox_config.netif }}" |
12 |
| - cores: "{{ item.proxmox_config.cores }}" |
13 |
| - memory: "{{ item.proxmox_config.memory }}" |
14 |
| - swap: "{{ item.proxmox_config.swap }}" |
15 |
| - password: "{{ item.proxmox_config.password }}" |
16 |
| - disk: "{{ item.proxmox_config.disk }}" |
17 |
| - mounts: "{{ item.proxmox_config.mounts }}" |
18 |
| - onboot: "{{ item.proxmox_config.onboot }}" |
19 |
| - unprivileged: "{{ item.proxmox_config.unprivileged }}" |
20 |
| - validate_certs: "{{ item.proxmox_config.validate_certs }}" |
21 |
| - description: "{{ item.proxmox_config.description }}" |
22 |
| - state: "{{ item.proxmox_config.state }}" |
23 |
| - features: "{{ item.proxmox_config.features }}" |
24 |
| - loop: "{{ lxc_nodes }}" |
25 |
| - when: lxc_nodes is defined |
26 |
| - register: container_creation_result |
27 |
| - |
28 |
| -- name: Start predefined nodes |
29 |
| - community.general.proxmox: |
30 |
| - api_user: "{{ api_user }}" |
31 |
| - api_password: "{{ api_password }}" |
32 |
| - api_host: "{{ proxmox_defaults.api_host }}" |
33 |
| - vmid: "{{ item.proxmox_config.vmid }}" |
34 |
| - state: 'started' |
35 |
| - loop: "{{ lxc_nodes }}" |
36 |
| - when: |
37 |
| - - lxc_nodes is defined |
38 |
| - - "'state' in item.proxmox_config" |
39 |
| - - "item.proxmox_config['state'] == 'present'" |
40 |
| - register: container_start_result |
41 |
| - |
42 | 3 | # - name: Create predefined containers
|
43 |
| -# community.general.proxmox: "{{ proxmox_defaults | combine(item.proxmox_config) }}" |
| 4 | +# community.general.proxmox: |
| 5 | +# api_user: "{{ api_user }}" |
| 6 | +# api_password: "{{ api_password }}" |
| 7 | +# api_host: "{{ proxmox_defaults.api_host }}" |
| 8 | +# vmid: "{{ item.proxmox_config.vmid }}" |
| 9 | +# hostname: "{{ item.proxmox_config.hostname }}" |
| 10 | +# template: "{{ item.proxmox_config.ostemplate }}" |
| 11 | +# netif: "{{ item.proxmox_config.netif }}" |
| 12 | +# cores: "{{ item.proxmox_config.cores }}" |
| 13 | +# memory: "{{ item.proxmox_config.memory }}" |
| 14 | +# swap: "{{ item.proxmox_config.swap }}" |
| 15 | +# password: "{{ item.proxmox_config.password }}" |
| 16 | +# disk: "{{ item.proxmox_config.disk }}" |
| 17 | +# mounts: "{{ item.proxmox_config.mounts }}" |
| 18 | +# onboot: "{{ item.proxmox_config.onboot }}" |
| 19 | +# unprivileged: "{{ item.proxmox_config.unprivileged }}" |
| 20 | +# validate_certs: "{{ item.proxmox_config.validate_certs }}" |
| 21 | +# description: "{{ item.proxmox_config.description }}" |
| 22 | +# state: "{{ item.proxmox_config.state }}" |
| 23 | +# features: "{{ item.proxmox_config.features }}" |
44 | 24 | # loop: "{{ lxc_nodes }}"
|
45 | 25 | # when: lxc_nodes is defined
|
46 | 26 | # register: container_creation_result
|
47 | 27 | #
|
48 | 28 | # - name: Start predefined nodes
|
49 |
| -# community.general.proxmox: "{{ proxmox_defaults | combine({'vmid': item.proxmox_config['vmid'], 'state': 'started'}) }}" |
| 29 | +# community.general.proxmox: |
| 30 | +# api_user: "{{ api_user }}" |
| 31 | +# api_password: "{{ api_password }}" |
| 32 | +# api_host: "{{ proxmox_defaults.api_host }}" |
| 33 | +# vmid: "{{ item.proxmox_config.vmid }}" |
| 34 | +# state: 'started' |
50 | 35 | # loop: "{{ lxc_nodes }}"
|
51 | 36 | # when:
|
52 | 37 | # - lxc_nodes is defined
|
53 |
| -# - item.proxmox_config['state'] == 'present' |
| 38 | +# - "'state' in item.proxmox_config" |
| 39 | +# - "item.proxmox_config['state'] == 'present'" |
54 | 40 | # register: container_start_result
|
| 41 | + |
| 42 | +- name: Create predefined containers |
| 43 | + community.general.proxmox: "{{ proxmox_defaults | combine(item.proxmox_config) }}" |
| 44 | + loop: "{{ lxc_nodes }}" |
| 45 | + when: lxc_nodes is defined |
| 46 | + register: container_creation_result |
| 47 | + |
| 48 | +- name: Start predefined nodes |
| 49 | + community.general.proxmox: "{{ proxmox_defaults | combine({'vmid': item.proxmox_config['vmid'], 'state': 'started'}) }}" |
| 50 | + loop: "{{ lxc_nodes }}" |
| 51 | + when: |
| 52 | + - lxc_nodes is defined |
| 53 | + - item.proxmox_config['state'] == 'present' |
| 54 | + register: container_start_result |
0 commit comments