ssh-keygen -t rsa
fileserver_backend:
- git
gitfs_remotes:
- git@10.4.4.72:jiangmingfei/salt-gitfs.git:
- pubkey: /root/.ssh/id_rsa.pub
- privkey: /root/.ssh/id_rsa
/etc/security/limits.conf:
file.append:
- text:
- '* soft nproc 102400'
- '* hard nproc 102400'
- '* soft nofile 102400'
- '* hard nofile 102400'
- '* soft core unlimited'
{% if grains.get('osmajorrelease')|int == 7 %}
/etc/systemd/system.conf:
file.append:
- text:
- ""
- "DefaultLimitCORE=infinity"
- "DefaultLimitNOFILE=102400"
- "DefaultLimitNPROC=102400"
{% endif %}
配置salt文件系统gitfs:
yum install epel-release -y
yum install gcc cmake libffi libffi-devel python-devel python2-pip GitPython -y
注意:
centos7.5上saltstack 2016.11版本兼容性:
pygit2依赖libgit2
(1)libgit2和pygit2兼容性解决过程
yum install libgit2 #版本是0.26.x
pip install pygit2 #解决各种依赖后,最后说要0.27.x版本
rpm -e libgit2现有版本
下载libgit2 0.27.6版本,编译安装:
unzip libgit2*.zip
mkdir build && cd build
cmake ..
cmake build
make install
pip install pygit2 #正常
saltstack报错如下:
No suitable gitfs provider module is installed
也就是说,libgit2和pygit2是兼容了,但是和当前saltstack版本不兼容
(2)libgit2和pygit2兼容解决
下载libgit2 0.26.8版本,编译覆盖安装:
unzip libgit2*.zip
mkdir build && cd build
cmake ..
cmake build
make install
pip uninstall pygit2
pip install 'pygit2<=0.26'
systemctl restart salt-master
libgit2和pygit2总结:
[root@server03 base]# salt 'client01' state.sls basic.os
client01:
----------
ID: /etc/security/limits.conf
Function: file.append
Result: True
Comment: Appended 5 lines
Started: 11:31:52.231718
Duration: 35.234 ms
Changes:
----------
diff:
---
+++
@@ -59,3 +59,8 @@
#@student - maxlogins 4
# End of file
+* soft nproc 102400
+* hard nproc 102400
+* soft nofile 102400
+* hard nofile 102400
+* soft core unlimited
----------
ID: /etc/systemd/system.conf
Function: file.append
Result: True
Comment: Appended 3 lines
Started: 11:31:52.267306
Duration: 12.09 ms
Changes:
----------
diff:
---
+++
@@ -58,3 +58,6 @@
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=
+DefaultLimitCORE=infinity
+DefaultLimitNOFILE=102400
+DefaultLimitNPROC=102400
Summary for client01
------------
Succeeded: 2 (changed=2)
Failed: 0
------------
Total states run: 2
Total run time: 47.324 ms
注意:
├── d55725f648512d455355cb68bdde756dcc6040880ac6e9b8e455374fd7686306
├── envs.p
├── hash
│ └── base
│ └── basic
│ └── os
│ ├── init.sls.hash.blob_sha1
│ └── init.sls.hash.sha256
├── refs
│ └── base
│ └── basic
│ └── os
│ └── init.sls #原始的状态管理配置文件
└── remote_map.txt
思路: