瀏覽代碼

Merge "added possibility to use list for sysfs params"

pull/162/head
Richard Felkl 6 年之前
父節點
當前提交
563f47cfac
共有 3 個文件被更改,包括 37 次插入4 次删除
  1. +18
    -2
      README.rst
  2. +10
    -1
      linux/files/sysfs.conf
  3. +9
    -1
      linux/system/sysfs.sls

+ 18
- 2
README.rst 查看文件

@@ -429,7 +429,7 @@ Load kernel modules and add them to `/etc/modules`:
- tp_smapi
- 8021q

Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
Configure or blacklist kernel modules with additional options to `/etc/modprobe.d` following example
will add `/etc/modprobe.d/nf_conntrack.conf` file with line `options nf_conntrack hashsize=262144`:

.. code-block:: yaml
@@ -554,7 +554,7 @@ Set additional shared library to Linux system library path
java:
- /usr/lib/jvm/jre-openjdk/lib/amd64/server
- /opt/java/jre/lib/amd64/server

Certificates
~~~~~~~~~~~~
@@ -601,6 +601,22 @@ Install sysfsutils and set sysfs attributes:
power/state: "root:power"
devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave

Optional: You can also use list that will ensure order of items.

.. code-block:: yaml

linux:
system:
sysfs:
scheduler:
block/sda/queue/scheduler: deadline
power:
- mode:
power/state: 0660
- owner:
power/state: "root:power"
- devices/system/cpu/cpu0/cpufreq/scaling_governor: powersave

Huge Pages
~~~~~~~~~~~~


+ 10
- 1
linux/files/sysfs.conf 查看文件

@@ -1,7 +1,15 @@
# Sysfs file for {{ name }} managed by salt-minion(1)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

{%- for key, value in sysfs.items() %}
{%- if sysfs is mapping %}
{%- set sysfs_list = [sysfs] %}
{%- else %}
{%- set sysfs_list = sysfs %}
{%- endif %}


{%- for item in sysfs_list %}
{%- for key, value in item.items() %}
{%- if key in ["mode", "owner"] %}
{%- for attr, val in value.items() %}
mode {{ attr }} = {{ val }}
@@ -10,6 +18,7 @@ mode {{ attr }} = {{ val }}
{{ key }} = {{ value }}
{%- endif %}
{%- endfor %}
{%- endfor %}

{#-
vim: syntax=jinja

+ 9
- 1
linux/system/sysfs.sls 查看文件

@@ -26,7 +26,14 @@ linux_sysfs_package:
- require:
- file: /etc/sysfs.d

{%- for key, value in sysfs.items() %}
{%- if sysfs is mapping %}
{%- set sysfs_list = [sysfs] %}
{%- else %}
{%- set sysfs_list = sysfs %}
{%- endif %}

{%- for item in sysfs_list %}
{%- for key, value in item.items() %}
{%- if key not in ["mode", "owner"] %}
{%- if grains.get('virtual_subtype', None) not in ['Docker', 'LXC'] %}
{#- Sysfs cannot be set in docker, LXC, etc. #}
@@ -40,3 +47,4 @@ linux_sysfs_write_{{ name }}_{{ key }}:
{%- endfor %}

{%- endfor %}
{%- endfor %}

Loading…
取消
儲存