Sfoglia il codice sorgente

rewrite LVM lv_present prevents unwanted LV shrink (#221)

* Update file.sls

add replace

* Update file.sls

update replace

* Update job.sls

Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
https://docs.saltstack.com/en/master/ref/states/all/salt.states.cron.html

* Update README.rst

Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.

* Update README.rst

* fix(deprecation): update to new method (#214)

Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>

* Allow swap to be completely disabled

* sort repos so they do not change order every run

* allow use of new state syntax for module.run

The new syntax has been supported since ~2017.
From the docs, in case they change:

! New Style
test.random_hash:
  module.run:
    - test.random_hash:
      - size: 42
      - hash_type: sha256

! Legacy Style
test.random_hash:
  module.run:
    - size: 42
    - hash_type: sha256

* Update map.jinja

Add support fpr Ubuntu Focal.

* Update file.sls

added possibility to delete files

* Network resolf.conf handling

the handling as the Resolv.conf is generated and adapted, adapted.
previously the Resolv.conf was created and then through
Overwrite "network.system" in the interface.sls again.
With two search servers that should actually be included.
"search example.com. sudomain.example.com"
but it always became that
search ['example.com.', 'sudomain.example.com']

The resolv.conf was first created correctly but then overwritten again in the interface.sls.

The problem only arises if you don't want to have a "Domain:" in resov.conf

* rewrite LVM lv_present

Since salt now also supports LV extend and reduce, the option Force must be used with care.

The changes include that force is only set if the corresponding LV does not yet exist (check via Grains) in order to overwrite any FS signatures (Wiping fs signature).

If the LV already exists (check via Grains), Force is set to False unless this is explicitly set to True in the pillars.

* Network resolf.conf handling (#220) (#8)

* Update file.sls

add replace

* Update file.sls

update replace

* Update job.sls

Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
https://docs.saltstack.com/en/master/ref/states/all/salt.states.cron.html

* Update README.rst

Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.

* Update README.rst

* fix(deprecation): update to new method (#214)

Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>

* Allow swap to be completely disabled

* sort repos so they do not change order every run

* allow use of new state syntax for module.run

The new syntax has been supported since ~2017.
From the docs, in case they change:

! New Style
test.random_hash:
  module.run:
    - test.random_hash:
      - size: 42
      - hash_type: sha256

! Legacy Style
test.random_hash:
  module.run:
    - size: 42
    - hash_type: sha256

* Update map.jinja

Add support fpr Ubuntu Focal.

* Update file.sls

added possibility to delete files

* Network resolf.conf handling

the handling as the Resolv.conf is generated and adapted, adapted.
previously the Resolv.conf was created and then through
Overwrite "network.system" in the interface.sls again.
With two search servers that should actually be included.
"search example.com. sudomain.example.com"
but it always became that
search ['example.com.', 'sudomain.example.com']

The resolv.conf was first created correctly but then overwritten again in the interface.sls.

The problem only arises if you don't want to have a "Domain:" in resov.conf

Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>

Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>

* Network resolf.conf handling (#220) (#9)

* Update file.sls

add replace

* Update file.sls

update replace

* Update job.sls

Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.
https://docs.saltstack.com/en/master/ref/states/all/salt.states.cron.html

* Update README.rst

Added the opportunity to set a job with a special keyword like '@reboot' or '@hourly'. Quotes must be used, otherwise PyYAML will strip the '@' sign.

* Update README.rst

* fix(deprecation): update to new method (#214)

Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>

* Allow swap to be completely disabled

* sort repos so they do not change order every run

* allow use of new state syntax for module.run

The new syntax has been supported since ~2017.
From the docs, in case they change:

! New Style
test.random_hash:
  module.run:
    - test.random_hash:
      - size: 42
      - hash_type: sha256

! Legacy Style
test.random_hash:
  module.run:
    - size: 42
    - hash_type: sha256

* Update map.jinja

Add support fpr Ubuntu Focal.

* Update file.sls

added possibility to delete files

* Network resolf.conf handling

the handling as the Resolv.conf is generated and adapted, adapted.
previously the Resolv.conf was created and then through
Overwrite "network.system" in the interface.sls again.
With two search servers that should actually be included.
"search example.com. sudomain.example.com"
but it always became that
search ['example.com.', 'sudomain.example.com']

The resolv.conf was first created correctly but then overwritten again in the interface.sls.

The problem only arises if you don't want to have a "Domain:" in resov.conf

Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>

Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>

* Update mount.sls

added the possibility to set the dump and pass option

dump
    The dump value to be passed into the fstab, Default is 0
pass_num
    The pass value to be passed into the fstab, Default is 0

* Update mount.sls

correction, wrong line.
added the possibility to set the dump and pass option

dump
    The dump value to be passed into the fstab, Default is 0
pass_num
    The pass value to be passed into the fstab, Default is 0

* Add Bind Mount Option

Add Bind Mount Option

* Add support for template defaults/context args

* Add IPv6 Interface Support

Add IPv6 Interface Support
First Version

* Fix warning in salt v3003

The 'gid_from_name' argument in the user.present state has been replaced
with 'usergroup'. Update your SLS file to get rid of this warning.

* Update map.jinja

add Jammy Support

---------

Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
Co-authored-by: Felipe Zipitría <fzipi@fing.edu.uy>
Co-authored-by: Kyle Gullion <kgullion@gmail.com>
Co-authored-by: Matthew Thode <thode@fsi.io>
Co-authored-by: Matthew Thode <mthode@mthode.org>
Co-authored-by: Bruno Binet <bruno.binet@gmail.com>
pull/234/head
preussal 1 anno fa
parent
commit
e18010ba88
Nessun account collegato all'indirizzo email del committer
6 ha cambiato i file con 101 aggiunte e 5 eliminazioni
  1. +67
    -2
      README.rst
  2. +3
    -0
      linux/map.jinja
  3. +14
    -0
      linux/network/interface.sls
  4. +8
    -2
      linux/storage/lvm.sls
  5. +3
    -1
      linux/storage/mount.sls
  6. +6
    -0
      linux/system/file.sls

+ 67
- 2
README.rst Vedi File

@@ -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.


+ 3
- 0
linux/map.jinja Vedi File

@@ -396,6 +396,9 @@ Debian:
'CentOS Stream 8': {
'lvm_services': ['lvm2-lvmpolld', 'lvm2-monitor'],
},
'jammy': {
'lvm_services': ['lvm2-monitor'],
},
'focal': {
'lvm_services': ['lvm2-monitor'],
},

+ 14
- 0
linux/network/interface.sls Vedi File

@@ -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 %}

+ 8
- 2
linux/storage/lvm.sls Vedi File

@@ -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] %}

+ 3
- 1
linux/storage/mount.sls Vedi File

@@ -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 }}

+ 6
- 0
linux/system/file.sls Vedi File

@@ -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 }}

Loading…
Annulla
Salva