Saltstack Study Note One

Source: Internet
Author: User
Tags saltstack


1, install Saltstack

Service side: Salt-master
Client: Salt-minion

Yum install-y Salt-masteryum install-y salt-minion

2, open service end iptables

Iptables-a input-m State--state new-m tcp-p TCP--dport 4505-j acceptiptables-a input-m State--state new-m TCP- P TCP--dport 4506-j ACCEPT

3, start the service

Service side:

Vim/etc/salt/masterinterface: Server listening IP, #默认0.0.0.0

Start the service:

/etc/init.d/salt-master start

Boot start:

Chkconfig Salt-master on

Debug mode:

Salt-master-l Dubeg

Running in the background:

Salt-master-d

Listening Port:
4505 (publish_port): Salt Message Publishing system
4506 (ret_port): Salt client-to-server communication port

Client:

Vim/etc/salt/minionmaster: server-side hostname ID: Client host name (see client's name on server)

Start the service:

/etc/init.d/salt-minion start

Boot start:

Chkconfig salt-minion on

4,key issued

salt-keyaccepted keys:unaccepted Keys:test.itnihao.comRejected keys:salt-key-a #添加所有客户端salt-key-a Minion-id #添加单独 A Minion ID

5, test

Salt \* test.pingvm-243:truevm-244:truevm-245:truevm-242:true

The above steps are to install Saltstack complete and communicate normally
Below to configure client service installation, file synchronization, etc.

6, install Apache

To create a portal file:

mkdir /srv/salt -pvim /srv/salt/top.slsbase:   ' * ':                #匹配客户端, the "*" match means matching all     -  web.apache     #web目录下apache. sls file mkdir /srv/salt/webvim /srv/salt/web/ apache.slsapache_install:  pkg:    - name: httpd     - installed  service:    - name: httpd     - running    - reload: true    - watch:       - file: /etc/httpd/conf/httpd.conf/etc/httpd/conf/httpd.conf:   file.managed:    - source: salt://web/httpd.conf.jinja     - template: jinja    - user: root    -  group: root    - mode: 644    - backup: minion/var/www/html/index.html:   file.managed:    - source: salt://web/index.html.jinja    -  template: jinjavim /srv/salt/web/httpd.conf.jinja<VirtualHost *:80>     servername {{ salt[' network.interfaces ' () [' eth0 '] [' inet '][0][' address '] }}     DocumentRoot /var/www/html/    ErrorLog logs/error.log     customlog logs/access.log common</virtualhost>vim /srv/salt/web/ index.html.jinja

Run command

salt \* state.sls web.apachevm-242:----------           ID: apache_install    Function: pkg.installed         Name: httpd      Result: True      Comment: Package httpd is already installed.      Started: 13:52:15.979353    Duration: 639.22 ms      Changes:   ----------           ID: /etc/httpd/conf/httpd.conf    Function: file.managed       result: true     comment: file /etc/httpd/conf /httpd.conf is in the correct state     started:  13:52:16.723650    duration: 80.393 ms     changes:   ----------           ID: apache_install    Function:  service.running        name: httpd       Result: True     Comment: The service httpd is  already running     started: 13:52:16.807976     duration: 41.296 ms     changes:   ----------           ID: /var/www/html/index.html     function: file.managed      result: true      comment: file /var/www/html/index.html updated     started:  13:52:16.853234    duration: 16.49 ms     changes:                  ----------               diff:                   New file               mode:                   0644summary------------succeeded: 4  (changed=1 ) failed:    0------------total states run:     4

Test, open Web Access

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/71/0F/wKioL1XEWT_QJndKAAB0trLr4QI130.jpg "style=" float: none; "title=" 9.jpg "alt=" Wkiol1xewt_qjndkaab0trlr4qi130.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/71/13/wKiom1XEV0SxlX_4AABr7yZGhIQ613.jpg "style=" float: none; "title=" 10.jpg "alt=" Wkiom1xev0sxlx_4aabr7yzghiq613.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/13/wKiom1XEV0bBY8UeAABrXYgfnxw204.jpg "style=" float: none; "title=" 11.jpg "alt=" Wkiom1xev0bby8ueaabrxygfnxw204.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/0F/wKioL1XEWUKTyO3JAABoYLkzEW4026.jpg "style=" float: none; "title=" 12.jpg "alt=" Wkiol1xewuktyo3jaaboylkzew4026.jpg "/>


This article is from the "Charlie_cen" blog, make sure to keep this source http://charlie928.blog.51cto.com/3741218/1682682

Saltstack Study Note One

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.