Saltstack (eight) configuration management deployment Lamp

Source: Internet
Author: User
Tags saltstack


Scenario: The company has 10 servers need to install lamp test environment, using Saltstack to write state files for batch deployment, can improve work efficiency, reduce the possibility of human error, to ensure the consistency of the environment.

Saltstack's configuration Management lamp actual case:

1. Modify the master configuration file to specify the dev environment.

4 ^file/etc/salt/master file_roots:  base:    -/srv/salt/base   Dev:    -/srv/salt/dev

2. Write the state file, and the final directory tree looks like this:

[Email protected] dev]# tree  /srv/salt/dev//srv/salt/dev/├──files│├──httpd.conf│└──my.cnf├──lamp.sls└── Top.sls14 files

The detailed contents of the 3.state file are as follows:

[email protected] dev]# cat Top.sls--can also be found here in/srv/salt/base/ Top.sls is defined in the Unified portal file. Dev:'node2.xkops.com':    -Lamp[[email protected] dev]# cat Lamp.sls lamp-pkg-install:pkg.installed:-names:-MySQL-PHP-php-MySQL-php-PDO-php-CLI-php-commonhttpd-service:pkg.installed:-names:-httpd file.managed:-Name:/etc/httpd/conf/httpd.conf-Source:salt://files/httpd.conf-User:root-Group:root-Mode:644-require:-pkg:httpd-Service service.running:-name:httpd-Enable:true-Reload:true-Watch:-file:httpd-Servicemysql-service:pkg.installed:-name:mysql-Server file.managed:-Name:/etc/my.cnf-Source:salt://files/my.cnf-User:root-Group:root-Mode:644-require:-pkg:mysql-Service service.running:-Name:mysqld-Enable:true-Watch:-File:mysql-service

4. Perform the configuration management state file on the master side of the Node1. (Recommended test first, then formally executed)
[[email protected] dev]# Salt ' * ' state.highstate env=dev test
[[email protected] dev]# Salt ' * ' state.highstate Env=dev

Saltstack (eight) configuration management deployment Lamp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.