diff --git a/README.rst b/README.rst index 594a3a5..a514faa 100644 --- a/README.rst +++ b/README.rst @@ -457,7 +457,7 @@ Systemd journal settings: journal: SystemMaxUse: "50M" RuntimeMaxFiles: "100" - + Ensure presence of directory: .. code-block:: yaml @@ -1368,6 +1368,29 @@ interface and DNS servers: - 8.8.4.4 mtu: 1500 + +Linux with IPv4 and IPv6 static network interfaces, default gateway + + .. code-block:: yaml + + linux: + network: + enabled: true + interface: + eth0: + enabled: true + type: eth + address: 192.168.0.102 + netmask: 255.255.255.0 + gateway: 192.168.0.1 + + enable_ipv6: true + ipv6proto: static + ipv6ipaddr: 1234:abcd::ffff:192.168.0.102 + ipv6gateway: 1234:abcd::ffff:192.168.0.1 + ipv6netmask: 64 + + Linux with bonded interfaces and disabled ``NetworkManager``: .. code-block:: yaml @@ -2068,6 +2091,25 @@ NFS mount: file_system: nfs opts: rw,sync +Bind mount: + +.. code-block:: yaml + + linux: + storage: + enabled: true + mount: + mount_bind: + enabled: true + path: /mnt/bind/name + device: /mnt/source/bind + file_system: none + opts: bind,defaults + dump: 0 + pass_num: 1 + + + File swap configuration: .. code-block:: yaml @@ -2119,6 +2161,30 @@ into ``/mnt/data``. size: 40G mount: ${linux:storage:mount:data} +Salt now also supports expanding and shrinking a LV: + +To reduce the size of an LV the option force must be set to true. +! Caution this can destroy the file system if it is not shrunk before ! +only some file systems can be shrunk. + +.. code-block:: yaml + + parameters: + linux: + lvm: + vg1: + enabled: true + devices: + - /dev/sdb + volume: + data: # to expand + size: 50G + mount: ${linux:storage:mount:data} + data: # to reduce + size: 30G + force: true + mount: ${linux:storage:mount:data} + Create partitions on disk. Specify size in MB. It expects empty disk without any existing partitions. Set ``startsector=1`` if you want to start partitions from ``2048``. @@ -2610,4 +2676,3 @@ Documentation and Bugs * #salt-formulas @ irc.freenode.net Use this IRC channel in case of any questions or feedback which is always welcome. - diff --git a/linux/map.jinja b/linux/map.jinja index 3b1fcf6..90925f7 100644 --- a/linux/map.jinja +++ b/linux/map.jinja @@ -396,6 +396,9 @@ Debian: 'CentOS Stream 8': { 'lvm_services': ['lvm2-lvmpolld', 'lvm2-monitor'], }, + 'jammy': { + 'lvm_services': ['lvm2-monitor'], + }, 'focal': { 'lvm_services': ['lvm2-monitor'], }, diff --git a/linux/network/interface.sls b/linux/network/interface.sls index 0241c18..447c4ce 100644 --- a/linux/network/interface.sls +++ b/linux/network/interface.sls @@ -263,6 +263,20 @@ linux_interface_{{ interface_name }}: {%- else %} - proto: {{ interface.get('proto', 'dhcp') }} {%- endif %} + + # IPv6 + {%- if interface.enable_ipv6 is defined %} + - enable_ipv6: {{ interface.enable_ipv6 }} + {%- if interface.ipv6ipaddr is defined %} + {%- if grains.os_family == 'Debian' %} + - ipv6proto: {{ interface.get('ipv6proto', 'static') }} + {%- endif %} + - ipv6ipaddr: {{ interface.ipv6ipaddr }} + - ipv6gateway: {{ interface.ipv6gateway }} + - ipv6netmask: {{ interface.ipv6netmask }} + {%- endif %} + {%- endif %} + {%- if interface.type == 'slave' %} - master: {{ interface.master }} {%- endif %} diff --git a/linux/storage/lvm.sls b/linux/storage/lvm.sls index c172e66..f0ff3e5 100644 --- a/linux/storage/lvm.sls +++ b/linux/storage/lvm.sls @@ -51,10 +51,16 @@ lvm_{{ vg.get('name', vgname) }}_lv_{{ volume.get('name', lvname) }}: - name: {{ volume.get('name', lvname) }} - vgname: {{ vg.get('name', vgname) }} - size: {{ volume.size }} - - force: true + {%- if (volume.force is defined and volume.force is sameas true) or + (volume.get('name', lvname) not in grains.lvm[vg.get('name', vgname)]) %} + - force: True + {%- else %} + - force: False + {%- endif %} - require: - lvm: lvm_vg_{{ vg.get('name', vgname) }} - {%- if volume.mount is defined %} + {%- if (volume.mount is defined) and + (volume.get('name', lvname) not in grains.lvm[vg.get('name', vgname)]) %} - require_in: - mount: {{ volume.mount.path }} {%- if not volume.mount.get('file_system', None) in ['nfs', 'nfs4', 'cifs', 'tmpfs', None] %} diff --git a/linux/storage/mount.sls b/linux/storage/mount.sls index 111670e..29dd090 100644 --- a/linux/storage/mount.sls +++ b/linux/storage/mount.sls @@ -5,7 +5,7 @@ {%- if mount.enabled %} -{%- if not mount.file_system in ['nfs', 'nfs4', 'cifs', 'tmpfs'] %} +{%- if not mount.file_system in ['nfs', 'nfs4', 'cifs', 'tmpfs', 'none'] %} mkfs_{{ mount.device}}: cmd.run: @@ -37,6 +37,8 @@ linux_storage_nfs_packages_{{ mount.path }}: - fstype: {{ mount.file_system }} - mkmnt: True - opts: {{ mount.get('opts', 'defaults,noatime') }} + - dump: {{ mount.dump|default('0', true) }} + - pass_num: {{ mount.pass_num|default('0', true) }} {%- if mount.file_system == 'xfs' %} - require: - pkg: xfs_packages_{{ mount.device }} diff --git a/linux/system/file.sls b/linux/system/file.sls index 0bbd539..375fbc4 100644 --- a/linux/system/file.sls +++ b/linux/system/file.sls @@ -27,6 +27,12 @@ linux_file_{{ file_name }}: {%- endif %} {%- if file.template is defined %} - template: {{ file.template }} + {%- if file.defaults is defined %} + - defaults: {{ file.defaults|json }} + {%- endif %} + {%- if file.context is defined %} + - context: {{ file.context|json }} + {%- endif %} {%- endif %} {%- elif file.contents is defined %} - contents: {{ file.contents|json }}