Browse Source

Make possible to configure/tune disks parameters (via sysfs)

Emmanuel Bouthenot 10 years ago
parent
commit
14cc588def

+ 2 - 0
group_vars/all

@@ -36,4 +36,6 @@ http_auth_admin_password: seVDetGvSs7nA # openssl passwd -crypt adm123in
 
 with_ovh: False
 
+sysfs_disk_settings: False
+
 # vim: ft=yaml

+ 8 - 0
roles/common/tasks/base.yml

@@ -55,6 +55,14 @@
   notify:
     - Refresh sysfs configuration
 
+- name: Install kernel configuration (sys) for disks
+  action: template src=kernel/sysfs.d/${item}.j2 dest=/etc/sysfs.d/${item} owner=root group=root mode=0644
+  with_items:
+      - 10-disks.conf
+  notify:
+    - Refresh sysfs configuration
+  when_boolean: ${sysfs_disk_settings}
+
 - name: Install sudo configuration
   action: template src=sudo/local-admin.j2 dest=/etc/sudoers.d/local-admin owner=root group=root mode=0440
 

+ 2 - 0
roles/common/templates/kernel/sysfs.d/00-sysfs-prolog.conf.j2

@@ -25,3 +25,5 @@
 # mode power/state = 0660
 # owner power/state = root:power
 
+
+

+ 10 - 0
roles/common/templates/kernel/sysfs.d/10-disks.conf.j2

@@ -0,0 +1,10 @@
+#
+# sysfs: disk settings / tuning
+#
+{% if sysfs_disk_settings %}
+{% for disk in ansible_devices -%}
+{% for param in sysfs_disk_settings %}
+block/{{ disk }}/{{ param.key }} = {{ param.value }}
+{% endfor %}
+{%- endfor %}
+{% endif %}