Skip to content

Commit 73955ef

Browse files
authored
Merge pull request #301 from lae/develop
Release 1.9.3
2 parents 58ac3be + f091a34 commit 73955ef

File tree

5 files changed

+39
-2
lines changed

5 files changed

+39
-2
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,11 @@ pve_storages:
683683
username: user
684684
password: supersecurepass
685685
domain: addomain.tld
686+
- name: empty-dir
687+
type: dir
688+
path: /mnt/empty-dir
689+
content: [ "images", "rootdir" ]
690+
create_subdirs: false
686691
```
687692

688693
Refer to https://pve.proxmox.com/pve-docs/api-viewer/index.html for more information.
@@ -738,6 +743,9 @@ pve_ceph_osds:
738743
- device: /dev/sdd
739744
block.db: /dev/sdb1
740745
encrypted: true
746+
# NVME OSD
747+
- device: /dev/nvme0n1
748+
crush.device.class: NVMe
741749
# Crush rules for different storage classes
742750
# By default 'type' is set to host, you can find valid types at
743751
# (https://docs.ceph.com/en/latest/rados/operations/crush-map/)

library/proxmox_storage.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@
161161
description:
162162
- Specifies whether or not the given path is an externally managed
163163
mountpoint.
164+
create_subdirs:
165+
required: false
166+
type: bool
167+
description:
168+
- Specifies whether or not to populate the directory with the default structure.
164169
namespace:
165170
required: false
166171
type: str
@@ -314,6 +319,7 @@ def __init__(self, module):
314319
self.thinpool = module.params['thinpool']
315320
self.sparse = module.params['sparse']
316321
self.is_mountpoint = module.params['is_mountpoint']
322+
self.create_subdirs = module.params['create_subdirs']
317323

318324
# namespace for pbs
319325
self.namespace = module.params['namespace']
@@ -414,6 +420,8 @@ def prepare_storage_args(self):
414420
args['sparse'] = 1 if self.sparse else 0
415421
if self.is_mountpoint is not None:
416422
args['is_mountpoint'] = 1 if self.is_mountpoint else 0
423+
if self.create_subdirs is not None:
424+
args['create-subdirs'] = 1 if self.create_subdirs else 0
417425

418426
# CIFS
419427
if self.subdir is not None:
@@ -587,6 +595,7 @@ def main():
587595
thinpool=dict(default=None, type='str', required=False),
588596
sparse=dict(default=None, type='bool', required=False),
589597
is_mountpoint=dict(default=None, type='bool', required=False),
598+
create_subdirs=dict(default=None, type='bool', required=False),
590599
namespace=dict(default=None, type='str', required=False),
591600
subdir=dict(default=None, type='str', required=False),
592601
domain=dict(default=None, type='str', required=False),

tasks/ceph.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
- name: Create Ceph OSDs
5656
ansible.builtin.command: >-
5757
pveceph osd create {{ item.device }}
58+
{% if "crush.device.class" in item %}--crush-device-class {{ item["crush.device.class"] }}{% endif %}
5859
{% if "encrypted" in item and item["encrypted"] | bool %}--encrypted 1{% endif %}
5960
{% if "block.db" in item %}--db_dev {{ item["block.db"] }}{% endif %}
6061
{% if "block.wal" in item %}--wal_dev {{ item["block.wal"] }}{% endif %}

tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@
349349
domain: "{{ item.domain | default(omit) }}"
350350
subdir: "{{ item.subdir | default(omit) }}"
351351
share: "{{ item.share | default(omit) }}"
352+
shared: "{{ item.shared | default(omit) }}"
353+
create_subdirs: "{{ item.create_subdirs | default(omit) }}"
354+
is_mountpoint: "{{ item.is_mountpoint | default(omit) }}"
352355
no_log: "{{ pve_no_log }}"
353356
with_items: "{{ pve_storages }}"
354357
when: "not pve_cluster_enabled | bool or (pve_cluster_enabled | bool and inventory_hostname == _init_node)"

tasks/ssh_cluster_config.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,35 @@
3838
Port {{ pve_ssh_port }}
3939
{% endfor %}
4040
41+
- name: Ensure SSH config directory exists
42+
ansible.builtin.file:
43+
path: /etc/ssh/sshd_config.d
44+
state: directory
45+
mode: "0755"
46+
4147
- name: Allow root logins from PVE cluster hosts
4248
ansible.builtin.blockinfile:
43-
dest: /etc/ssh/sshd_config
49+
dest: /etc/ssh/sshd_config.d/00-pve.conf
50+
create: yes
51+
mode: "0640"
4452
marker: "# {mark}: Allow root logins from PVE hosts (managed by ansible)."
4553
content: |
4654
{% for host in groups[pve_group] %}
4755
Match Address {{ hostvars[host].pve_cluster_ssh_addrs | join(",") }}
48-
PermitRootLogin prohibit-password
56+
PermitRootLogin prohibit-password
4957
{% endfor %}
5058
validate: "/usr/sbin/sshd -t -f %s"
5159
notify:
5260
- reload ssh server configuration
5361

62+
- name: Remove SSH configuration from main sshd_config if present in favor of config in sshd_config.d
63+
ansible.builtin.blockinfile:
64+
path: /etc/ssh/sshd_config
65+
marker: "# {mark}: Allow root logins from PVE hosts (managed by ansible)."
66+
state: absent
67+
notify:
68+
- reload ssh server configuration
69+
5470
- name: Enable and start SSH server
5571
ansible.builtin.systemd:
5672
name: ssh.service

0 commit comments

Comments
 (0)