add additional shared libraries (#137)
* This merge request gives the ability to add shared libaries without set LD_LIBRARY_PATH variable.
1. Generate file in /etc/ld.so.conf.d/
2. update /etc/ld.so.cache with ldconfig command
example pillars:
linux:
system:
enabled: True
ld:
libraries:
java:
- /usr/lib/jvm/jre-openjdk/lib/amd64/server
- /opt/java/jre/lib/amd64/server
* fix format in README.rst for Shared Libraries
* Fix for #137 - change pillar libraries key to library
diff --git a/README.rst b/README.rst
index b90c0f5..1449ee1 100644
--- a/README.rst
+++ b/README.rst
@@ -420,6 +420,23 @@
cpu:
governor: performance
+
+Shared Libraries
+~~~~~~~~~~~~~~~~
+
+Set additional shared library to Linux system library path
+
+.. code-block:: yaml
+
+ linux:
+ system:
+ ld:
+ library:
+ java:
+ - /usr/lib/jvm/jre-openjdk/lib/amd64/server
+ - /opt/java/jre/lib/amd64/server
+
+
Certificates
~~~~~~~~~~~~
diff --git a/linux/system/init.sls b/linux/system/init.sls
index e17adc5..25008a8 100644
--- a/linux/system/init.sls
+++ b/linux/system/init.sls
@@ -99,6 +99,9 @@
{%- if system.directory is defined %}
- linux.system.directory
{%- endif %}
+{%- if system.ld is defined %}
+- linux.system.ld
+{%- endif %}
{%- if system.apt is defined and grains.os_family == 'Debian' %}
- linux.system.apt
{%- endif %}
diff --git a/linux/system/ld.sls b/linux/system/ld.sls
new file mode 100644
index 0000000..fb239da
--- /dev/null
+++ b/linux/system/ld.sls
@@ -0,0 +1,23 @@
+{%- from "linux/map.jinja" import system with context %}
+
+{%- if system.enabled %}
+
+{%- for key in system.ld.library %}
+/etc/ld.so.conf.d/{{ key }}.conf:
+ file.managed:
+ - user: root
+ - group: root
+ - mode: 644
+ - contents: |
+ {% for val in system.ld.library[key] -%}
+ {{ val }}
+ {% endfor %}
+ - watch_in:
+ - cmd: ldconfig_update
+{% endfor %}
+
+ldconfig_update:
+ cmd.wait:
+ - name: ldconfig
+
+{% endif %}