Skip to content
Home
Products
Solutions
Customers Enterprise Community Docs
Support
Live Demo

SaltStack State Best Practices

Apache Configuration Example

[root@linux-node1 ~]# vim /srv/salt/lamp/apache.sls
apche-install:
  pkg.installed:
    - name: httpd

apache-config:
  file.managed:
    - name: /etc/httpd/conf/httpd.conf
    - source: salt://apache/files/httpd.conf
    - user: root
    - group: root
    - mode: 644

apache-service:
  service.running:
    - name: httpd
    - enable: True

MySQL Configuration Example

[root@linux-node1 ~]# vim /srv/salt/lamp/mysql.sls
mysql-install:
  pkg.installed:
    - pkgs:
      - mariadb
      - mariadb-server

mysql-config:
  file.managed:
    - name: /etc/my.cnf
    - source: salt://mysql/files/my.cnf
    - user: root
    - group: root
    - mode: 644

mysql-service:
  service.running:
    - name: mariadb
    - enable: True
Document