Skip to content

Commit

Permalink
doc: update docs/ansible.md & update CONTRIBUTING.md (#535)
Browse files Browse the repository at this point in the history
* doc: update ansible.md

* doc: update ansible.md 代码格式

* 增加十分钟同步的域名、增加自动部署脚本

* 优化部署文档:定时任务同步pages的内容

* 优化 git-down-pages.sh 脚本 到配置

* update  README.md

---------

Co-authored-by: 魏栋梁 <[email protected]> 893391c
  • Loading branch information
jaywcjlove committed Feb 28, 2024
1 parent d43da03 commit 7bb0fe3
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 200 deletions.
220 changes: 111 additions & 109 deletions CONTRIBUTORS.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion data.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data.json

Large diffs are not rendered by default.

106 changes: 18 additions & 88 deletions docs/ansible.html
Original file line number Diff line number Diff line change
Expand Up @@ -414,94 +414,24 @@ <h4 id="静态inventory"><a aria-hidden="true" tabindex="-1" href="#静态invent


























































































<table class="style-list"><thead><tr><th>:-</th><th>-</th><th>-</th></tr></thead><tbody><tr><td>ping</td><td>检查指定节点机器是否还能连通</td><td>ansible all -m ping</td></tr><tr><td>command</td><td>用于在各受控端节点运行指定的命令</td><td>ansible all -m command -a 'hostname'</td></tr><tr><td>shell</td><td>shell模块可以特殊字符,而command是不支持</td><td>ansible all -m shell -a 'hostname &#x26;&#x26; date'</td></tr><tr><td>hostname</td><td>修改远程受控节点的主机名的模块</td><td>ansible -i /opt/hosts xx -m hostname -a 'name=ansible-client-199'</td></tr><tr><td>copy</td><td>在远程主机执行复制操作文件</td><td>ansible all -m copy -a 'src=/etc/hosts dest=/opt/hosts backup=yes'</td></tr><tr><td>fetch</td><td>从远程主机获取文件到管理节点,但是不支持目录操作</td><td>ansible all -m fetch -a "src=/etc/yum.repos.d/epel.repo dest=/usr/local/src"</td></tr><tr><td>script</td><td>管理端一个脚本,然后在远程服务器上执行</td><td>ansible all -m script -a '/root/time.sh'</td></tr><tr><td>file</td><td>主要用于远程主机上的文件和目录操作</td><td>ansible all -m file -a "path=/root/rsync.password mode=600 state=touch"</td></tr><tr><td>cron</td><td>管理执行任务计划模块(增删改查)</td><td>ansible all -m cron -a "name='test a job' user=root job='/bin/sh /server/scripts/test.sh' minute=* hour=* day=* month=* weekday=*"</td></tr><tr><td>yum</td><td>RedHat和CentOS的软件包安装和管理</td><td>安装<br>ansible all -m yum -a "name=httpd state=present"<br>ansible all -m yum -a "name=httpd state=installed"<br>卸载<br>ansible all -m yum -a "name=httpd state=absent"<br>ansible all -m yum -a "name=httpd state=removed"</td></tr><tr><td>service和systemd</td><td>用于管理远程主机的服务</td><td>ansible all -m systemd -a "name=httpd state=started enabled=yes"<br>ansible all -m systemd -a "name=httpd state=restarted"</td></tr><tr><td>user</td><td>useradd, userdel, usermod</td><td>ansible all -m user -a 'name=haha remove=no state=absent'</td></tr><tr><td>group</td><td>groupadd, groupdel, groupmod</td><td>ansible all -m group -a 'name=mygroup state=absent'</td></tr><tr><td>setup</td><td>可收集远程主机的facts变量的信息</td><td>ansible all -m setup -a 'filter=ansible_default_ipv4'</td></tr><tr><td>authorized_key</td><td>为特定的用户账号添加或删除 SSH authorized keys</td><td>ansible all -m authorized_key -a "user=root key='{{lookup('file','/root/.ssh/id_rsa.pub')}}' path=/root/.ssh/authorized_keys manage_dir=no"</td></tr><tr><td>replace</td><td>和 sed 命令比较类似,用于正则匹配和替换</td><td>ansible all -m replace -a "path=/etc/fstab regexp=^(UUID.*) replace='#\1'"</td></tr><tr><td>lineinfile</td><td>正则匹配,更改某个关键参数值</td><td>ansible all -m lineinfile -a "path=/etc/selinux/config regexp='^SELINUX=' line='SELINUX=disabled'"</td></tr></tbody></table>
<table><thead><tr><th>:-</th><th>-</th><th>-</th></tr></thead></table>
<p class="style-list">| ping | 检查指定节点机器是否还能连通 | <code>ansible all -m ping</code> |
| command | 用于在各受控端节点运行指定的命令 | <code>ansible all -m command -a 'hostname'</code> |
| shell | shell模块可以特殊字符,而command是不支持 | <code>ansible all -m shell -a 'hostname &#x26;&#x26; date'</code> |
| hostname | 修改远程受控节点的主机名的模块 | <code>ansible -i /opt/hosts xx -m hostname -a 'name=ansible-client-199'</code> |
| copy | 在远程主机执行复制操作文件 | <code>ansible all -m copy -a 'src=/etc/hosts dest=/opt/hosts backup=yes'</code> |
| fetch | 从远程主机获取文件到管理节点,但是不支持目录操作 | <code>ansible all -m fetch -a "src=/etc/yum.repos.d/epel.repo dest=/usr/local/src"</code> |
| script | 管理端一个脚本,然后在远程服务器上执行 | <code>ansible all -m script -a '/root/time.sh'</code> |
| file | 主要用于远程主机上的文件和目录操作 | <code>ansible all -m file -a "path=/root/rsync.password mode=600 state=touch"</code> |
| cron | 管理执行任务计划模块(增删改查) | <code>ansible all -m cron -a "name='test a job' user=root job='/bin/sh /server/scripts/test.sh' minute=* hour=* day=* month=* weekday=*"</code> |
| yum | RedHat和CentOS的软件包安装和管理 | <code>安装&#x3C;br />ansible all -m yum -a "name=httpd state=present"&#x3C;br/>ansible all -m yum -a "name=httpd state=installed"&#x3C;br />卸载&#x3C;br />ansible all -m yum -a "name=httpd state=absent"&#x3C;br/>ansible all -m yum -a "name=httpd state=removed"</code> |
| service和systemd | 用于管理远程主机的服务 | <code>ansible all -m systemd -a "name=httpd state=started enabled=yes"&#x3C;br />ansible all -m systemd -a "name=httpd state=restarted"</code> |
| user | useradd, userdel, usermod | <code>ansible all -m user -a 'name=haha remove=no state=absent'</code> |
| group | groupadd, groupdel, groupmod | <code>ansible all -m group -a 'name=mygroup state=absent'</code> |
| setup | 可收集远程主机的facts变量的信息 | <code>ansible all -m setup -a 'filter=ansible_default_ipv4'</code> |
| authorized_key | 为特定的用户账号添加或删除 SSH authorized keys | <code>ansible all -m authorized_key -a "user=root key='{{lookup('file','/root/.ssh/id_rsa.pub')}}' path=/root/.ssh/authorized_keys manage_dir=no"</code> |
| replace | 和 sed 命令比较类似,用于正则匹配和替换 | <code>ansible all -m replace -a "path=/etc/fstab regexp=^(UUID.*) replace='#\1'"</code> |
| lineinfile | 正则匹配,更改某个关键参数值 | <code>ansible all -m lineinfile -a "path=/etc/selinux/config regexp='^SELINUX=' line='SELINUX=disabled'"</code> |</p>
<!--rehype:className=style-list-->
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="ansible-doc"><a aria-hidden="true" tabindex="-1" href="#ansible-doc"><span class="icon icon-link"></span></a>ansible-doc</h3><div class="wrap-body">
<p>在本地访问文档</p>
Expand Down
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,10 @@
<path d="M483.049 159.706c10.855-24.575 21.424-60.438 21.424-87.871 0-72.722-79.641-98.371-209.673-38.577-107.632-7.181-211.221 73.67-237.098 186.457 30.852-34.862 78.271-82.298 121.977-101.158C125.404 166.85 79.128 228.002 43.992 291.725 23.246 329.651 0 390.94 0 436.747c0 98.575 92.854 86.5 180.251 42.006 31.423 15.43 66.559 15.573 101.695 15.573 97.124 0 184.249-54.294 216.814-146.022H377.927c-52.509 88.593-196.819 52.996-196.819-47.436H509.9c6.407-43.581-1.655-95.715-26.851-141.162zM64.559 346.877c17.711 51.15 53.703 95.871 100.266 123.304-88.741 48.94-173.267 29.096-100.266-123.304zm115.977-108.873c2-55.151 50.276-94.871 103.98-94.871 53.418 0 101.981 39.72 103.981 94.871H180.536zm184.536-187.6c21.425-10.287 48.563-22.003 72.558-22.003 31.422 0 54.274 21.717 54.274 53.722 0 20.003-7.427 49.007-14.569 67.867-26.28-42.292-65.986-81.584-112.263-99.586z"></path>
</svg>
<span>xiechengqi.top</span></a><!--rehype:target=_blank&data-info=👆每天自动同步-->
<a href="https://memo.ownit.top" target="_blank" data-info="👆每十分钟自动同步"><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 512 512" height="1em" width="1em">
<path d="M483.049 159.706c10.855-24.575 21.424-60.438 21.424-87.871 0-72.722-79.641-98.371-209.673-38.577-107.632-7.181-211.221 73.67-237.098 186.457 30.852-34.862 78.271-82.298 121.977-101.158C125.404 166.85 79.128 228.002 43.992 291.725 23.246 329.651 0 390.94 0 436.747c0 98.575 92.854 86.5 180.251 42.006 31.423 15.43 66.559 15.573 101.695 15.573 97.124 0 184.249-54.294 216.814-146.022H377.927c-52.509 88.593-196.819 52.996-196.819-47.436H509.9c6.407-43.581-1.655-95.715-26.851-141.162zM64.559 346.877c17.711 51.15 53.703 95.871 100.266 123.304-88.741 48.94-173.267 29.096-100.266-123.304zm115.977-108.873c2-55.151 50.276-94.871 103.98-94.871 53.418 0 101.981 39.72 103.981 94.871H180.536zm184.536-187.6c21.425-10.287 48.563-22.003 72.558-22.003 31.422 0 54.274 21.717 54.274 53.722 0 20.003-7.427 49.007-14.569 67.867-26.28-42.292-65.986-81.584-112.263-99.586z"></path>
</svg>
<span>ownit.top</span></a><!--rehype:target=_blank&data-info=👆每十分钟自动同步-->
<a href="https://cheat.666666.dev" target="_blank" data-info="👆每天自动同步"><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 512 512" height="1em" width="1em">
<path d="M483.049 159.706c10.855-24.575 21.424-60.438 21.424-87.871 0-72.722-79.641-98.371-209.673-38.577-107.632-7.181-211.221 73.67-237.098 186.457 30.852-34.862 78.271-82.298 121.977-101.158C125.404 166.85 79.128 228.002 43.992 291.725 23.246 329.651 0 390.94 0 436.747c0 98.575 92.854 86.5 180.251 42.006 31.423 15.43 66.559 15.573 101.695 15.573 97.124 0 184.249-54.294 216.814-146.022H377.927c-52.509 88.593-196.819 52.996-196.819-47.436H509.9c6.407-43.581-1.655-95.715-26.851-141.162zM64.559 346.877c17.711 51.15 53.703 95.871 100.266 123.304-88.741 48.94-173.267 29.096-100.266-123.304zm115.977-108.873c2-55.151 50.276-94.871 103.98-94.871 53.418 0 101.981 39.72 103.981 94.871H180.536zm184.536-187.6c21.425-10.287 48.563-22.003 72.558-22.003 31.422 0 54.274 21.717 54.274 53.722 0 20.003-7.427 49.007-14.569 67.867-26.28-42.292-65.986-81.584-112.263-99.586z"></path>
</svg>
Expand Down Expand Up @@ -1474,7 +1478,7 @@
<!--rehype:class=home-card home-links-->
<p>如果你有资源,可以很方便<a href="https://github.com/jaywcjlove/reference/issues/102#issue-1451649637">部署 web 版</a>,这非常简单,只需要克隆 <a href="https://github.com/jaywcjlove/reference/tree/gh-pages">gh-pages</a> 分支代码到你的静态服务就可以了,还可以使用 <a href="https://hub.docker.com/r/wcjiang/reference">docker</a> 快捷部署 web 版。</p>

</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang. Updated on 2024/02/28 13:15:50</footer></footer><script src="data.js?v=1.5.2" defer></script><script src="js/fuse.min.js?v=1.5.2" defer></script><script src="js/main.js?v=1.5.2" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang. Updated on 2024/02/28 23:58:39</footer></footer><script src="data.js?v=1.5.2" defer></script><script src="js/fuse.min.js?v=1.5.2" defer></script><script src="js/main.js?v=1.5.2" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
<path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
</svg><input id="mysearch-input" type="search" placeholder="搜索" autocomplete="off"><div class="mysearch-clear"></div></div><button id="mysearch-close" type="button">搜索</button></div><div class="mysearch-result"><div id="mysearch-menu"></div><div id="mysearch-content"></div></div></div></div></body>
</html>

0 comments on commit 7bb0fe3

Please sign in to comment.