Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy apache in batches with Saltstack

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How to deploy apache in batches with Saltstack? I believe that many novice rookies have not yet learned this skill, through the summary of this article, I hope you can learn to use Saltstack to deploy apache in batches.

The experimental environment prepares the name, role address, centos7-minmaster192.168.142.172centos7-min2client192.168.142.110 experiment step 1, the main server-- control node

Install the epel source and install the control side

Yum install-y epel-release / / install the epel source yum-y install salt-master / / install the console

Modify the control side master configuration file

The vi / etc/salt/master// is modified as follows: 15 lines interface: 192.168.142.172 / / listening address line 215 auto_accept: True / / avoid running salt-key to confirm the root location of the certificate authentication 416 line file_roots: base:-/ srv/salt / / saltstack file, the directory needs to manually create 710 line group categories: (here there is only one client in the experimental environment Only one can be set) nodegroups: group1: 'web01.saltstack.com'552 line pillar_opts: True / / enable pillar function, synchronize file function 529line pillar_roots: base:-/ srv/pillar / / pillar's home directory, which needs to be created manually

Set up a salt&pillar directory

Mkdir / srv/saltmkdir / srv/pillar

Start the service and turn off the core protection function

Systemctl start salt-mastersystemctl enable salt-master// turns off the core function setenforce 0

Check the status of service startup

Netstat-anpt | egrep '4505 | the dedicated port for message publishing of salt / / 4506 is the port tcp 0 0192.168.142.172LISTEN 13704/pythontcp 0192.168.142.172LISTEN 13704/pythontcp 0192.168.142.172LISTEN 13704/pythontcp: 36688 ESTABLISHED 13704/pythontcp 0 192.168.142.172 ESTABLISHED 13692/python 4505 192.168.142.110 ESTABLISHED 13692/python II, Slave server-controlled node

Install the epel source and install the controlled terminal

Yum install-y epel-release / / install the epel source yum-y install salt-minion / / install the controlled side

Modify the configuration file of the controlled side

The configuration of vi / etc/salt/minion// is modified as follows: 16 lines master: 192.168.172.142 / / specify IP78 line id: web01.saltstack.com / / specify the hostname of the controlled side

Start the service

/ / start the service systemctl start salt-minion of the controlled side

Check at the main control terminal

/ / Test the communication status between the master terminal and the controlled terminal (the * symbol represents all the controlled hosts) salt'* 'test.pingweb01.saltstack.com: True// check the key salt-key-LAccepted Keys:web01.saltstack.comDenied Keys:Unaccepted Keys:web01.saltstack.comRejected Keys: note:

The following occurs during the inspection:

Salt request timed out. The master is not responding. If this error persists after verifying the master is up, worker_threads may need to be increased.

Please check the configuration file format yourself or restart the server.

3. Batch deployment of Apache all of the following operations are performed on the masterside cd / srv/salt/vim top.sls// to add base:'*':-apache// execute the apache module vim apache.sls// on all clients and add apache-service: pkg.installed:-names:-httpd- httpd-devel service.running:-name: httpd- enable: True// restart as shown below When the service systemctl restart salt-master.service// executes the batch deployment command salt'* 'state.highstate//, the following message appears after the execution is completed: web01.saltstack.com:- ID: apache-service Function: pkg.installed Name: httpd Result: True Comment: The following packages were installed/updated: httpd Started: 1515 04state.highstate// 51.323952 Duration: 40217.299 ms Changes :-apr:-new: 1.4.8-5.el7 old: apr-util:- New: 1.5.2-6.el7 old: httpd:-new: 2.4.6-90.el7.centos old: httpd-tools: -new: 2.4.6-90.el7.centos old: mailcap:-new: 2.1.41-2. El7 old:- ID: apache-service Function: pkg.installed Name: httpd-devel Result: True Comment: The following packages were installed/updated: httpd-devel Started: 15 bank 05purl 31.545046 Duration: 16876.92 ms Changes:-apr-devel: -new: 1.4.8-5.el7 old: apr-util-devel:-new: 1.5.2-6.el7 Old: cyrus-sasl:-new: 2.1.26-23.el7 old: 2.1.26-21.el7 cyrus-sasl-devel: -new: 2.1.26-23.el7 old: cyrus-sasl-gssapi:-new: 2.1.26-23.el7 Old: 2.1.26-21.el7 cyrus-sasl-lib:-new: 2.1.26-23.el7 old: 2.1.26-21.el7 Cyrus-sasl-md5:-new: 2.1.26-23.el7 old: 2.1.26-21.el7 cyrus-sasl-plain:- New: 2.1.26-23.el7 old: 2.1.26-21.el7 cyrus-sasl-scram:-new: 2.1.26-23 .el7 old: 2.1.26-21.el7 expat-devel:-new: 2.1.0-10.el7_3 old: httpd-devel: -new: 2.4.6-90.el7.centos old: libdb:-new: 5.3.21-25.el7 Old: 5.3.21-20.el7 libdb-devel:-new: 5.3.21-25.el7 old: libdb-utils:- -new: 5.3.21-25.el7 old: 5.3.21-20.el7 openldap:-new: 2.4. 44-21.el7_6 old: 2.4.44-5.el7 openldap-devel:-new: 2.4.44-21.el7_6 old:- ID: apache-service Function: service.running Name: httpd Result: True Comment: Service httpd has been enabled Duration: 1822.995 ms Changes:-httpd: TrueSummary-Succeeded: 3 (changed=3) and is running Started: 0 4. Check the test results web01: [root@web01 ~] # rpm-Q httpdhttpd-2.4.6-90.el7.centos.x86_64 [root@web01 ~] # netstat-ntap | grep 80tcp6 00: 80: * LISTEN 6

After reading this article, have you learned how to deploy apache in batches using Saltstack? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report