saltstack需要挂载点

时间:2015-01-06 22:37:35

标签: mount salt-stack

所以我有一个基本的saltstack状态文件来安装和配置应用程序 - 在这种情况下是Influxdb。但是,我希望使用salt来管理块设备的安装,并在运行之前通过应用程序获得require d。

/opt/influxdb/shared/data/db:
  mount.mounted:
    - device: /dev/vdb1
    - fstype: ext4
    - mkmnt: True
    - opts:
      - defaults

influxdb:
  pkg.installed:
    - sources:
      - influxdb: salt://influxdb/influxdb-0.8.8-1.x86_64.rpm
  service.running:
    - require:
      - pkg: influxdb
    - watch:
      - file: /opt/influxdb/current/config.toml
  module.run:
    - name: influxdb.db_create
    - m_name: test_db

/opt/influxdb/current/config.toml:
  file.managed:
    - name: /opt/influxdb/current/config.toml
    - template: jinja
    - source:
      - salt://ptolemy/influxdb.toml

python-pip:
  pkg.installed

influxdb-python:
  pip.installed:
    - name: influxdb
    - require:
       - pkg: python-pip

我想我想在service.running下的influxdb下找一些东西。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

您需要在require下添加新属性并列出其他要求。它应该是这样的:

influxdb:
  pkg.installed:
    - sources:
      - influxdb: salt://influxdb/influxdb-0.8.8-1.x86_64.rpm
  service.running:
    - require:
      - pkg: influxdb
      - mount: /opt/influxdb/shared/data/db
    - watch:
      - file: /opt/influxdb/current/config.toml

有关requirehttp://docs.saltstack.com/en/latest/ref/states/requisites.html

的文档,请参阅此处