|
1 |
| -# Standards: 0.2 |
| 1 | + # Standards: 0.2 |
2 | 2 | ---
|
3 | 3 | - name: Create predefined containers
|
4 | 4 | community.general.proxmox:
|
| 5 | + api_user: "{{ api_user }}" |
| 6 | + api_password: "{{ api_password }}" |
5 | 7 | api_host: "{{ proxmox_defaults.api_host }}"
|
6 |
| - api_user: "{{ proxmox_defaults.api_user }}" |
7 |
| - api_password: "{{ proxmox_defaults.api_password | default(omit) }}" |
8 |
| - api_token_id: "{{ proxmox_defaults.api_token_id | default(omit) }}" |
9 |
| - api_token_secret: "{{ proxmox_defaults.api_token_secret | default(omit) }}" |
10 |
| - node: "{{ item.proxmox_config.node }}" |
11 |
| - password: "{{ item.proxmox_config.password }}" |
12 |
| - hostname: "{{ item.proxmox_config.hostname }}" |
13 |
| - ostemplate: "{{ item.proxmox_config.ostemplate }}" |
14 |
| - disk: "{{ item.proxmox_config.disk | default(omit) }}" |
15 |
| - cores: "{{ item.proxmox_config.cores | default(omit) }}" |
16 |
| - memory: "{{ item.proxmox_config.memory | default(omit) }}" |
17 |
| - swap: "{{ item.proxmox_config.swap | default(omit) }}" |
18 |
| - netif: "{{ item.proxmox_config.netif | default(omit) }}" |
19 |
| - features: "{{ item.proxmox_config.features | to_json | default(omit) }}" |
20 |
| - onboot: "{{ item.proxmox_config.onboot | default(omit) }}" |
21 |
| - unprivileged: "{{ item.proxmox_config.unprivileged | default(omit) }}" |
22 | 8 | vmid: "{{ item.proxmox_config.vmid }}"
|
23 |
| - state: "{{ item.proxmox_config.state | default('present') }}" |
| 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 | 24 | loop: "{{ lxc_nodes }}"
|
25 | 25 | when: lxc_nodes is defined
|
26 | 26 | register: container_creation_result
|
27 |
| - no_log: True # Adjust based on your security policies |
28 | 27 |
|
29 |
| -- name: Start predefined nodes if not already started |
| 28 | +- name: Start predefined nodes |
30 | 29 | community.general.proxmox:
|
| 30 | + api_user: "{{ api_user }}" |
| 31 | + api_password: "{{ api_password }}" |
31 | 32 | api_host: "{{ proxmox_defaults.api_host }}"
|
32 |
| - api_user: "{{ proxmox_defaults.api_user }}" |
33 |
| - api_password: "{{ proxmox_defaults.api_password | default(omit) }}" |
34 |
| - api_token_id: "{{ proxmox_defaults.api_token_id | default(omit) }}" |
35 |
| - api_token_secret: "{{ proxmox_defaults.api_token_secret | default(omit) }}" |
36 |
| - node: "{{ item.proxmox_config.node }}" |
37 | 33 | vmid: "{{ item.proxmox_config.vmid }}"
|
38 | 34 | state: 'started'
|
39 | 35 | loop: "{{ lxc_nodes }}"
|
40 | 36 | when:
|
41 | 37 | - lxc_nodes is defined
|
42 |
| - - item.proxmox_config.state == 'present' |
| 38 | + - "'state' in item.proxmox_config" |
| 39 | + - "item.proxmox_config['state'] == 'present'" |
43 | 40 | register: container_start_result
|
44 |
| - no_log: True # Adjust based on your security policies |
45 |
| - |
46 |
| - # - name: Create predefined containers |
47 |
| - # community.general.proxmox: "{{ proxmox_defaults | combine(item.proxmox_config) }}" |
48 |
| - # loop: "{{ lxc_nodes }}" |
49 |
| - # when: lxc_nodes is defined |
50 |
| - # register: container_creation_result |
51 |
| - # |
52 |
| - # - name: Start predefined nodes |
53 |
| - # community.general.proxmox: "{{ proxmox_defaults | combine({'vmid': item.proxmox_config['vmid'], 'state': 'started'}) }}" |
54 |
| - # loop: "{{ lxc_nodes }}" |
55 |
| - # when: |
56 |
| - # - lxc_nodes is defined |
57 |
| - # - item.proxmox_config['state'] == 'present' |
58 |
| - # register: container_start_result |
59 | 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