salt.states.alternatives

配置替代品系统

Control the alternatives system

{% set my_hadoop_conf = '/opt/hadoop/conf' %}

{{ my_hadoop_conf }}:
  file.directory

hadoop-0.20-conf:
  alternatives.install:
    - name: hadoop-0.20-conf
    - link: /etc/hadoop-0.20/conf
    - path: {{ my_hadoop_conf }}
    - priority: 30
    - require:
      - file: {{ my_hadoop_conf }}

hadoop-0.20-conf:
  alternatives.remove:
      - name: hadoop-0.20-conf
      - path: {{ my_hadoop_conf }}
salt.states.alternatives.auto(name)

0.17.0 新版功能.

Instruct alternatives to use the highest priority path for <name>

name
is the master name for this link group (e.g. pager)
salt.states.alternatives.install(name, link, path, priority)

Install new alternative for defined <name>

name
is the master name for this link group (e.g. pager)
link
is the symlink pointing to /etc/alternatives/<name>. (e.g. /usr/bin/pager)
path
is the location of the new alternative target. NB: This file / directory must already exist. (e.g. /usr/bin/less)
priority
is an integer; options with higher numbers have higher priority in automatic mode.
salt.states.alternatives.remove(name, path)

Removes installed alternative for defined <name> and <path> or fallback to default alternative, if some defined before.

name
is the master name for this link group (e.g. pager)
path
is the location of one of the alternative target files. (e.g. /usr/bin/less)
salt.states.alternatives.set(name, path)

0.17.0 新版功能.

Sets alternative for <name> to <path>, if <path> is defined as an alternative for <name>.

name
is the master name for this link group (e.g. pager)
path
is the location of one of the alternative target files. (e.g. /usr/bin/less)