165 lines
No EOL
7 KiB
HTML
165 lines
No EOL
7 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="tool" content="leanote-desktop-app">
|
||
<title>salt自动化部署</title>
|
||
<style>
|
||
|
||
*{font-family:"lucida grande","lucida sans unicode",lucida,helvetica,"Hiragino Sans GB","Microsoft YaHei","WenQuanYi Micro Hei",sans-serif;}
|
||
|
||
body {
|
||
margin: 0;
|
||
}
|
||
|
||
/*公用文字样式*/
|
||
h1{font-size:30px}h2{font-size:24px}h3{font-size:18px}h4{font-size:14px}
|
||
.note-container{
|
||
width:850px;
|
||
margin:auto;
|
||
padding: 10px 20px;
|
||
box-shadow: 1px 1px 10px #eee;
|
||
}
|
||
#title {
|
||
margin: 0;
|
||
}
|
||
table {
|
||
margin-bottom: 16px;
|
||
border-collapse: collapse;
|
||
}
|
||
table th, table td {
|
||
padding: 6px 13px;
|
||
border: 1px solid #ddd;
|
||
}
|
||
table th {
|
||
font-weight: bold;
|
||
}
|
||
|
||
table tr {
|
||
background-color: none;
|
||
border-top: 1px solid #ccc;
|
||
}
|
||
table tr:nth-child(2n) {
|
||
background-color: rgb(247, 247, 249);
|
||
}
|
||
.mce-item-table, .mce-item-table td, .mce-item-table th, .mce-item-table caption {
|
||
border: 1px solid #ddd;
|
||
border-collapse: collapse;
|
||
padding: 6px 13px;
|
||
}
|
||
blockquote {
|
||
border-left-width:10px;
|
||
background-color:rgba(128,128,128,0.05);
|
||
border-top-right-radius:5px;
|
||
border-bottom-right-radius:5px;
|
||
padding:15px 20px;
|
||
border-left:5px solid rgba(128,128,128,0.075);
|
||
}
|
||
blockquote p {
|
||
margin-bottom:1.1em;
|
||
font-size:1em;
|
||
line-height:1.45
|
||
}
|
||
blockquote ul:last-child,blockquote ol:last-child {
|
||
margin-bottom:0
|
||
}
|
||
pre {
|
||
padding: 18px;
|
||
background-color: #f7f7f9;
|
||
border: 1px solid #e1e1e8;
|
||
border-radius: 3px;
|
||
display: block;
|
||
}
|
||
code {
|
||
padding: 2px 4px;
|
||
font-size: 90%;
|
||
color: #c7254e;
|
||
white-space: nowrap;
|
||
background-color: #f9f2f4;
|
||
border-radius: 4px;
|
||
}
|
||
.footnote {
|
||
vertical-align: top;
|
||
position: relative;
|
||
top: -0.5em;
|
||
font-size: .8em;
|
||
}
|
||
|
||
hr {
|
||
margin:2em 0
|
||
}
|
||
img {
|
||
max-width:100%
|
||
}
|
||
pre {
|
||
word-break:break-word
|
||
}
|
||
p,pre,pre.prettyprint,blockquote {
|
||
margin:0 0 1.1em
|
||
}
|
||
hr {
|
||
margin:2em 0
|
||
}
|
||
img {
|
||
max-width:100%
|
||
}
|
||
.sequence-diagram,.flow-chart {
|
||
text-align:center;
|
||
margin-bottom:1.1em
|
||
}
|
||
.sequence-diagram text,.flow-chart text {
|
||
font-size:15px !important;
|
||
font-family:"Source Sans Pro",sans-serif !important
|
||
}
|
||
.sequence-diagram [fill="#ffffff"],.flow-chart [fill="#ffffff"] {
|
||
fill:#f6f6f6
|
||
}
|
||
.sequence-diagram [stroke="#000000"],.flow-chart [stroke="#000000"] {
|
||
stroke:#3f3f3f
|
||
}
|
||
.sequence-diagram text[stroke="#000000"],.flow-chart text[stroke="#000000"] {
|
||
stroke:none
|
||
}
|
||
.sequence-diagram [fill="#000"],.flow-chart [fill="#000"],.sequence-diagram [fill="#000000"],.flow-chart [fill="#000000"],.sequence-diagram [fill="black"],.flow-chart [fill="black"] {
|
||
fill:#3f3f3f
|
||
}
|
||
ul,ol {
|
||
margin-bottom:1.1em
|
||
}
|
||
ul ul,ol ul,ul ol,ol ol {
|
||
margin-bottom:1.1em
|
||
}
|
||
kbd {
|
||
padding:.1em .6em;
|
||
border:1px solid rgba(63,63,63,0.25);
|
||
-webkit-box-shadow:0 1px 0 rgba(63,63,63,0.25);
|
||
box-shadow:0 1px 0 rgba(63,63,63,0.25);
|
||
font-size:.7em;
|
||
font-family:sans-serif;
|
||
background-color:#fff;
|
||
color:#333;
|
||
border-radius:3px;
|
||
display:inline-block;
|
||
margin:0 .1em;
|
||
white-space:nowrap
|
||
}
|
||
.toc ul {
|
||
list-style-type:none;
|
||
margin-bottom:15px
|
||
}
|
||
</style>
|
||
<!-- 该css供自定义样式 -->
|
||
<link href="../leanote-html.css" rel="stylesheet">
|
||
</head>
|
||
|
||
<body>
|
||
|
||
<div class="note-container">
|
||
<h1 class="title" id="leanote-title">salt自动化部署</h1>
|
||
<div class="content-html" id="leanote-content"><div><span style="font-size: medium;" data-mce-style="font-size: medium;"><strong>安装 salt <a href="https://docs.saltstack.com/" data-mce-href="https://docs.saltstack.com/">https://docs.saltstack.com</a></strong></span></div><div><div>客户端步骤1<a href="https://repo.saltstack.com/yum/redhat/6/x86_64/latest/SALTSTACK-GPG-KEY.pub" data-mce-href="https://repo.saltstack.com/yum/redhat/6/x86_64/latest/SALTSTACK-GPG-KEY.pub">rpm --import <img id="__LEANOTE_D_IMG_1479693222457" src="http://192.168.56.4:9000/api/file/getImage?fileId=5833dcfc23eeeb0f8f0000c2" alt="" data-media-type="image" data-attr-org-src-id="D9041261FE0D438AA2EABC198358662A" data-attr-org-img-file="file:///C:/Users/Administrator/AppData/Local/YNote/data/hongxiutianmo@163.com/80e8d6e7e47b47b99a49bfc255eac4f3/tydyecokvdyb.png" data-mce-src="http://192.168.56.4:9000/api/file/getImage?fileId=5833dcfc23eeeb0f8f0000c2">https://repo.saltstack.com/yum/redhat/6/x86_64/latest/SALTSTACK-GPG-KEY.pub</a></div><div><div><br></div><div><div>vi /etc/yum.repos.d/CentOS-Base.repo </div></div><div>[saltstack-repo]</div><div>name=SaltStack repo for RHEL/CentOS $releasever</div><div>baseurl=<a href="https://repo.saltstack.com/yum/redhat/" data-mce-href="https://repo.saltstack.com/yum/redhat/">https://repo.saltstack.com/yum/redhat/</a>$releasever/$basearch/latest</div><div>enabled=1</div><div>gpgcheck=1</div><div>gpgkey=<a href="https://repo.saltstack.com/yum/redhat/" data-mce-href="https://repo.saltstack.com/yum/redhat/">https://repo.saltstack.com/yum/redhat/</a>$releasever/$basearch/latest/$releaseverSALTSTACK-GPG-KEY.pub</div></div><div><br></div><div>yum -y install salt-minion</div><div><br></div><div>查看版本<div>salt-call --versions-report </div></div><div><br></div></div><p><span style="font-size: medium;" data-mce-style="font-size: medium;"><strong>客户端配置安装</strong></span></p><div><span style="color: #ff0000;" data-mce-style="color: #ff0000;">注意</span>安装salt-minion</div><div><div>1、修改hosts</div><div>添加</div><div>172.16.3.1 salt</div><div>2、修改配置文件/etc/salt/minion</div><div>先备份原来的minion,再用minion.rpmnew替换minion</div><div>id: hostname</div><div>3、重启salt</div><div>/etc/init.d/salt-minion restart</div><div><br></div><div><span style="font-size: medium;" data-mce-style="font-size: medium;"><strong>服务器端配置</strong></span></div><div><span style="color: #ff0000;" data-mce-style="color: #ff0000;">注意</span>安装salt-master</div><div>在172.16.3.1上面协商saltkey</div></div><div>1、查看是否对应服务器是否被信任</div><div>#salt-key -L ##-L 列表</div><div>2、添加信任</div><div>#salt-key -a hostname ##-a accept</div><div>3、测试是否连通</div><div>#salt hostname test.ping</div><div><div>4、在服务器端编辑对应客户端配置文件</div><div>/srv/pillar/appcfg</div><div>5、编辑init.sls,添加对应配置信息</div><div>若是双主,类似</div><div><div>#钱盒gas</div><div>{% if grains['fqdn'] == 'SHPD-I04-SRV02' or grains['fqdn'] == 'SHPD-I03-SRV02' %}</div><div>include:</div><div> - appcfg.gas</div><div>{% endif %}</div><div><br></div></div><div>6、验证fqdn是否正确</div><div><div>salt SHPD-I03-SRV02 grains.item fqdn</div></div><div><br></div><div>检测连通性</div><div><div>salt2 target(hostname) appdeploy.pappcfg user</div></div><br></div><div>salt2 相当于重命名salt,防提权,例</div><div>salt2 SHPD-H04-SRV09 appdeploy.go workbench 2015-11-19/workbench-20151119.inc.zip</div><div><br></div></div>
|
||
</div>
|
||
|
||
<!-- 该js供其它处理 -->
|
||
<script src="../leanote-html.js"></script>
|
||
</body>
|
||
</html> |