Selaa lähdekoodia

Allow setting policy-rc.d

tags/2016.12
Filip Pytloun 9 vuotta sitten
vanhempi
commit
7731b8581c
5 muutettua tiedostoa jossa 51 lisäystä ja 0 poistoa
  1. +14
    -0
      README.rst
  2. +10
    -0
      linux/files/policy-rc.d
  3. +3
    -0
      linux/system/init.sls
  4. +19
    -0
      linux/system/policyrcd.sls
  5. +5
    -0
      tests/pillar/system.sls

+ 14
- 0
README.rst Näytä tiedosto

@@ -139,6 +139,20 @@ Enable autologin on tty1 (may work only for Ubuntu 14.04):

To disable set autologin to `false`.

Set ``policy-rc.d`` on Debian-based systems. Action can be any available
command in ``while true`` loop and ``case`` context.
Following will disallow dpkg to stop/start services for cassandra package automatically:

.. code-block:: yaml

linux:
system:
policyrcd:
- package: cassandra
action: exit 101
- package: '*'
action: switch

Kernel
~~~~~~


+ 10
- 0
linux/files/policy-rc.d Näytä tiedosto

@@ -0,0 +1,10 @@
{%- from "linux/map.jinja" import system with context -%}
#!/bin/sh

while true; do
case $1 in
{%- for policy in system.policyrcd %}
{{ policy.package }}) {{ policy.action }};;
{%- endfor %}
esac
done

+ 3
- 0
linux/system/init.sls Näytä tiedosto

@@ -51,3 +51,6 @@ include:
{%- if system.motd|length > 0 %}
- linux.system.motd
{%- endif %}
{%- if system.get('policyrcd', [])|length > 0 %}
- linux.system.policyrcd
{%- endif %}

+ 19
- 0
linux/system/policyrcd.sls Näytä tiedosto

@@ -0,0 +1,19 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %}

policyrcd_file:
file.managed:
- name: /usr/local/sbin/policy-rc.d
- source: salt://linux/files/policy-rc.d
- mode: 655
- template: jinja

policyrcd_alternatives:
alternatives.install:
- name: policy-rc.d
- link: /usr/sbin/policy-rc.d
- path: /usr/local/sbin/policy-rc.d
- require:
- file: policyrcd_file

{%- endif %}

+ 5
- 0
tests/pillar/system.sls Näytä tiedosto

@@ -64,3 +64,8 @@ linux:
opencontrail:
source: "deb http://ppa.launchpad.net/tcpcloud/contrail-2.20/ubuntu trusty main"
architectures: amd64
policyrcd:
- package: cassandra
action: exit 101
- package: '*'
action: switch

Loading…
Peruuta
Tallenna