跳转至
首页 解决方案 下载 文档
演示环境

SaltStack State最佳实践

Apache配置案例

[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配置案例

[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