Merge branch 'vlans' into 'master'
VLAN networking support
this should add VLAN networking setup.
from DOCs..
```
bond0.10:
network.managed:
- type: vlan
- ipaddr: 10.1.0.4
- use:
- network: bond0
- require:
- network: bond0
```
See merge request !9
diff --git a/README.rst b/README.rst
index 12c7d65..bd9d7f2 100644
--- a/README.rst
+++ b/README.rst
@@ -382,6 +382,28 @@
device: /swapfile
size: 1024
+LVM group `vg1` with one device and `data` volume mounted into `/mnt/data`
+
+.. code-block:: yaml
+
+ parameters:
+ linux:
+ storage:
+ mount:
+ data:
+ device: /dev/vg1/data
+ file_system: ext4
+ path: /mnt/data
+ lvm:
+ vg1:
+ enabled: true
+ devices:
+ - /dev/sdb
+ volume:
+ data:
+ size: 40G
+ mount: ${linux:storage:mount:data}
+
Usage
=====
diff --git a/linux/map.jinja b/linux/map.jinja
index bcf5d44..ecb0a51 100644
--- a/linux/map.jinja
+++ b/linux/map.jinja
@@ -104,17 +104,21 @@
'Arch': {
'mount': {},
'swap': {},
+ 'lvm': {},
'multipath': False,
},
'Debian': {
'mount': {},
'swap': {},
+ 'lvm': {},
'multipath': False,
'multipath_pkgs': ['multipath-tools']
+ 'lvm_pkgs': ['lvm2']
},
'RedHat': {
'mount': {},
'swap': {},
+ 'lvm': {},
'multipath': False,
},
}, grain='os_family', merge=salt['pillar.get']('linux:storage')) %}
diff --git a/linux/storage/init.sls b/linux/storage/init.sls
index f4f90e9..214c452 100644
--- a/linux/storage/init.sls
+++ b/linux/storage/init.sls
@@ -7,6 +7,9 @@
{%- if storage.swap|length > 0 %}
- linux.storage.swap
{%- endif %}
+{%- if storage.lvm|length > 0 %}
+- linux.storage.lvm
+{%- endif %}
{%- if storage.multipath %}
- linux.storage.multipath
{%- endif %}
diff --git a/linux/storage/lvm.sls b/linux/storage/lvm.sls
new file mode 100644
index 0000000..2cc7fec
--- /dev/null
+++ b/linux/storage/lvm.sls
@@ -0,0 +1,48 @@
+{%- from "linux/map.jinja" import storage with context %}
+{%- if storage.enabled %}
+
+
+linux_lvm_pkgs:
+ pkg.installed:
+ - names: {{ storage.lvm_pkgs }}
+
+{%- for vgname, vg in storage.lvm.iteritems() %}
+
+{%- if vg.get('enabled', True) %}
+
+{%- for dev in vg.devices %}
+lvm_{{ vgname }}_pv_{{ dev }}:
+ lvm.pv_present:
+ - name: dev
+ - require:
+ - pkg: linux_lvm_pkgs
+ - require_in:
+ - lvm: lvm_vg_{{ vgname }}
+{%- endfor %}
+
+lvm_vg_{{ vgname }}:
+ lvm.vg_present:
+ - name: {{ vgname }}
+ - devices: {{ vg.devices }}
+
+{%- for lvname, volume in vg.volume.iteritems() %}
+
+lvm_{{ vgname }}_lv_{{ lvname }}:
+ lvm.lv_present:
+ - name: {{ lvname }}
+ - vgname: {{ vgname }}
+ - size: {{ volume.size }}
+ - require:
+ - lvm: lvm_vg_{{ vgname }}
+ {%- if volume.mount is defined %}
+ - require_in:
+ - mount: {{ volume.mount.path }}
+ {%- endif %}
+
+{%- endfor %}
+
+{%- endif %}
+
+{%- endfor %}
+
+{%- endif %}