kvm-host: Add LVM filter when needed
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2671|8|2663|5|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/439//ansiblelint">Evolix » ansible-roles » unstable #439</a>
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2671|8|2663|5|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/439//ansiblelint">Evolix » ansible-roles » unstable #439</a>
gitea/ansible-roles/pipeline/head This commit looks good
This commit is contained in:
parent
d93eb2495b
commit
c2de4b4cd1
5 changed files with 56 additions and 1 deletions
|
@ -26,6 +26,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
|||
* webapps/nextcloud: Add condition for config tasks
|
||||
* webapps/nextcloud: Added var nextcloud_user_uid to enforce uid for nextcloud user
|
||||
* webapps/nextcloud: Set ownership and permissions of data directory
|
||||
* kvm-host: Automatically add an LVM filter when LVM is present
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -3,4 +3,11 @@ kvm_custom_libvirt_images_path: ''
|
|||
kvm_install_drbd: True
|
||||
kvm_scripts_dir: /usr/local/sbin
|
||||
|
||||
kvm_pair: null
|
||||
kvm_pair: null
|
||||
|
||||
# A "r|.*/|" is always added in order to make this an allowlist
|
||||
# Default = all sata/scsi disks + all nvme + all md (+partitions)
|
||||
lvm_filter:
|
||||
- '"a|^/dev/sd[a-zA-Z]+[0-9]*$|"'
|
||||
- '"a|^/dev/nvme[0-9]+(n[0-9]+)?(p[0-9]+)?$|"'
|
||||
- '"a|^/dev/md[0-9]+$|"'
|
|
@ -3,3 +3,11 @@
|
|||
ansible.builtin.service:
|
||||
name: munin-node
|
||||
state: restarted
|
||||
|
||||
- name: Update initramfs
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- '/usr/sbin/update-initramfs'
|
||||
- '-k'
|
||||
- 'all'
|
||||
- '-u'
|
37
kvm-host/tasks/lvm.yml
Normal file
37
kvm-host/tasks/lvm.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
|
||||
- name: 'Figure out if /etc/lvm/lvm.conf exists'
|
||||
ansible.builtin.stat:
|
||||
path: '/etc/lvm/lvm.conf'
|
||||
follow: true
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
get_attributes: false
|
||||
ignore_errors: true
|
||||
register: lvm_conf_stat
|
||||
|
||||
- name: Add LVM filter
|
||||
ansible.builtin.lineinfile:
|
||||
path: '/etc/lvm/lvm.conf'
|
||||
insertafter: '# Configuration option devices/filter.'
|
||||
regexp: '^\s*(#\s*)?filter\s*=\s*\[.*\]'
|
||||
line: " filter = [ {{ lvm_filter | list | join(', ') }}, \"r|.*/|\" ]"
|
||||
state: present
|
||||
firstmatch: true
|
||||
notify: 'Update initramfs'
|
||||
when:
|
||||
- lvm_conf_stat is succeeded
|
||||
- lvm_conf_stat.stat.exists | bool
|
||||
|
||||
- name: Add LVM global_filter
|
||||
ansible.builtin.lineinfile:
|
||||
path: '/etc/lvm/lvm.conf'
|
||||
insertafter: '# Configuration option devices/global_filter.'
|
||||
regexp: '^\s*(#\s*)?global_filter\s*=\s*\[.*\]'
|
||||
line: " global_filter = [ {{ lvm_filter | list | join(', ') }}, \"r|.*/|\" ]"
|
||||
state: present
|
||||
firstmatch: true
|
||||
notify: 'Update initramfs'
|
||||
when:
|
||||
- lvm_conf_stat is succeeded
|
||||
- lvm_conf_stat.stat.exists | bool
|
|
@ -4,6 +4,8 @@
|
|||
name: evolix/drbd
|
||||
when: kvm_install_drbd
|
||||
|
||||
- ansible.builtin.import_tasks: lvm.yml
|
||||
|
||||
## TODO: check why it's disabled
|
||||
- ansible.builtin.include: ssh.yml
|
||||
|
||||
|
|
Loading…
Reference in a new issue