Skip to content

Commit fdef651

Browse files
committed
recommended changes added
see PR#251
1 parent 23e9f0a commit fdef651

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ pve_users: [] # List of user definitions to manage in PVE. See section on User M
422422
pve_storages: [] # List of storages to manage in PVE. See section on Storage Management.
423423
pve_datacenter_cfg: {} # Dictionary to configure the PVE datacenter.cfg config file.
424424
pve_domains_cfg: [] # List of realms to use as authentication sources in the PVE domains.cfg config file.
425+
pve_no_log: false # Set this to true in production to disable logging for strorage add to avoid having credentials leaked in log.
425426
```
426427

427428
To enable clustering with this role, configure the following variables appropriately:

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ pve_storages: []
5757
pve_ssh_port: 22
5858
pve_manage_ssh: true
5959
pve_hooks: {}
60-
no_logging: false
60+
pve_no_logging: false

library/proxmox_storage.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@
194194
pool: rpool/data
195195
sparse: true
196196
- name: CIFS-Share
197-
proxmox_Storage:
197+
proxmox_storage:
198198
name: cifs1
199199
server: cifs-host.domain.tld
200200
type: cifs
201-
content: ["snippets", "vztmpl", "iso" ]
201+
content: [ "snippets", "vztmpl", "iso" ]
202202
share: sharename
203203
subdir: /subdir
204204
username: user
@@ -251,6 +251,7 @@ def __init__(self, module):
251251
self.domain = module.params['domain']
252252
self.subdir = module.params['subdir']
253253
self.share = module.params['share']
254+
254255
# Validate the parameters given to us
255256
fingerprint_re = re.compile('^([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}$')
256257
if self.fingerprint is not None and not fingerprint_re.match(self.fingerprint):
@@ -355,6 +356,7 @@ def prepare_storage_args(self):
355356
self.module.fail_json(msg="krbd is only allowed with 'rbd' storage type")
356357
if self.share is not None:
357358
args['share'] = self.share
359+
358360
return args
359361

360362
def create_storage(self):
@@ -426,7 +428,7 @@ def main():
426428
nodes=dict(type='list', required=False, default=None),
427429
type=dict(default=None, type='str', required=True,
428430
choices=["dir", "nfs", "rbd", "lvm", "lvmthin", "cephfs",
429-
"zfspool", "btrfs", "pbs","cifs"]),
431+
"zfspool", "btrfs", "pbs", "cifs"]),
430432
# Remaining PVE API arguments (depending on type) past this point
431433
datastore=dict(default=None, type='str', required=False),
432434
encryption_key=dict(default=None, type='str', required=False),
@@ -450,7 +452,6 @@ def main():
450452
subdir=dict(default=None, type='str', required=False),
451453
domain=dict(default=None, type='str', required=False),
452454
share=dict(default=None, type='str', required=False),
453-
454455
)
455456

456457
module = AnsibleModule(

tasks/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,7 @@
337337
domain: "{{ item.domain | default(omit) }}"
338338
subdir: "{{ item.subdir | default(omit) }}"
339339
share: "{{ item.share | default(omit) }}"
340-
# Set logging to true in production in ypur groupvars
341-
no_log: "{{ no_logging | default(false) }}"
340+
no_log: "{{ pve_no_logging }}"
342341
with_items: "{{ pve_storages }}"
343342
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"
344343
tags: storage

tasks/pve_add_node.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
- name: Add node to Proxmox cluster
1818
ansible.builtin.command: >-
1919
pvecm add {{ hostvars[_init_node].pve_cluster_addr0 }} -use_ssh
20-
-link0 {{ pve_cluster_addr0 }},priority={{ pve_cluster_prio0 | default(omit)}}
20+
-link0 {{ pve_cluster_addr0 }},priority={% if pve_cluster_addr0_priority is defined %},priority={{ pve_cluster_addr0_priority }}{% endif %}
2121
{% if pve_cluster_addr1 is defined %}
22-
-link1 {{ pve_cluster_addr1 }},priority={{ pve_cluster_prio1 | default(omit)}}
22+
-link1 {{ pve_cluster_addr1 }},priority={% if pve_cluster_addr1_priority is defined %},priority={{ pve_cluster_addr1_priority }}{% endif %}
2323
{% endif %}
2424
# Ensure that nodes join one-by-one because cluster joins create a lock
2525
throttle: 1

tasks/pve_cluster_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
- name: Initialize a Proxmox cluster
5050
ansible.builtin.command: >-
5151
pvecm create {{ pve_cluster_clustername }}
52-
-link0 {{ pve_cluster_addr0 }},priority={{ pve_cluster_prio0 | default(omit)}}
52+
-link0 {{ pve_cluster_addr0 }},priority={{ pve_cluster_addr0_priority | default(0)}}
5353
{% if pve_cluster_addr1 is defined %}
54-
-link1 {{ pve_cluster_addr1 }},priority={{ pve_cluster_prio1 | default(omit)}}
54+
-link1 {{ pve_cluster_addr1 }},priority={{ pve_cluster_addr1_priority | default(1)}}
5555
{% endif %}
5656
args:
5757
creates: "{{ pve_cluster_conf }}"

0 commit comments

Comments
 (0)