yee379
yee379

Reputation: 6762

saltstack require for mount point

so i have a basic saltstack statefile to install and configure an app - in this case influxdb. however, i would like salt to manage the mounting of a block device and have that required by the app before running it.

/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

i guess i would want something under service.running under influxdb. can anyone help?

Upvotes: 1

Views: 1083

Answers (1)

ahus1
ahus1

Reputation: 5950

You'll need to add a new attribute below require and list additional requirements. It should look like this:

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

See here for documentation on require: http://docs.saltstack.com/en/latest/ref/states/requisites.html

Upvotes: 2

Related Questions