{"id":153,"date":"2026-03-21T22:47:20","date_gmt":"2026-03-21T14:47:20","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/install-ansible\/"},"modified":"2026-03-21T23:23:48","modified_gmt":"2026-03-21T15:23:48","slug":"install-ansible","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/install-ansible\/","title":{"rendered":"Ansible"},"content":{"rendered":"<h1>Ansible<\/h1>\n<h1>Ansible &#23433;&#35013;<\/h1>\n<p>&#23558; OpenClaw &#37096;&#32626;&#21040;&#29983;&#20135;&#26381;&#21153;&#22120;&#30340;&#25512;&#33616;&#26041;&#24335;&#26159;&#36890;&#36807; <strong><a href=\"https:\/\/github.com\/openclaw\/openclaw-ansible\">openclaw-ansible<\/a><\/strong> &mdash; &#19968;&#20010;&#23433;&#20840;&#20248;&#20808;&#26550;&#26500;&#30340;&#33258;&#21160;&#21270;&#23433;&#35013;&#31243;&#24207;&#12290;<\/p>\n<h2>&#24555;&#36895;&#24320;&#22987;<\/h2>\n<p>&#19968;&#26465;&#21629;&#20196;&#23433;&#35013;&#65306;<\/p>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\ncurl -fsSL https:\/\/raw.githubusercontent.com\/openclaw\/openclaw-ansible\/main\/install.sh | bash<\/p>\n<pre><code>\n&gt; **&#128230; &#23436;&#25972;&#25351;&#21335;&#65306;[github.com\/openclaw\/openclaw-ansible](https:\/\/github.com\/openclaw\/openclaw-ansible)**\n&gt;\n&gt; openclaw-ansible &#20179;&#24211;&#26159; Ansible &#37096;&#32626;&#30340;&#26435;&#23041;&#26469;&#28304;&#12290;&#26412;&#39029;&#26159;&#24555;&#36895;&#27010;&#36848;&#12290;\n\n## &#20320;&#23558;&#33719;&#24471;\n\n* &#128274; **&#38450;&#28779;&#22681;&#20248;&#20808;&#23433;&#20840;**&#65306;UFW + Docker &#38548;&#31163;&#65288;&#20165; SSH + Tailscale &#21487;&#35775;&#38382;&#65289;\n* &#128272; **Tailscale VPN**&#65306;&#23433;&#20840;&#36828;&#31243;&#35775;&#38382;&#65292;&#26080;&#38656;&#20844;&#24320;&#26292;&#38706;&#26381;&#21153;\n* &#128051; **Docker**&#65306;&#38548;&#31163;&#30340;&#27801;&#31665;&#23481;&#22120;&#65292;&#20165;&#32465;&#23450; localhost\n* &#128737;&#65039; **&#32437;&#28145;&#38450;&#24481;**&#65306;4 &#23618;&#23433;&#20840;&#26550;&#26500;\n* &#128640; **&#19968;&#26465;&#21629;&#20196;&#35774;&#32622;**&#65306;&#20960;&#20998;&#38047;&#20869;&#23436;&#25104;&#37096;&#32626;\n* &#128295; **Systemd &#38598;&#25104;**&#65306;&#24102;&#21152;&#22266;&#30340;&#24320;&#26426;&#33258;&#21551;&#21160;\n\n## &#35201;&#27714;\n\n* **&#25805;&#20316;&#31995;&#32479;**&#65306;Debian 11+ &#25110; Ubuntu 20.04+\n* **&#35775;&#38382;&#26435;&#38480;**&#65306;Root &#25110; sudo &#26435;&#38480;\n* **&#32593;&#32476;**&#65306;&#29992;&#20110;&#21253;&#23433;&#35013;&#30340;&#20114;&#32852;&#32593;&#36830;&#25509;\n* **Ansible**&#65306;2.14+&#65288;&#30001;&#24555;&#36895;&#21551;&#21160;&#33050;&#26412;&#33258;&#21160;&#23433;&#35013;&#65289;\n\n## &#23433;&#35013;&#20869;&#23481;\n\nAnsible playbook &#23433;&#35013;&#24182;&#37197;&#32622;&#65306;\n\n1. **Tailscale**&#65288;&#29992;&#20110;&#23433;&#20840;&#36828;&#31243;&#35775;&#38382;&#30340; mesh VPN&#65289;\n2. **UFW &#38450;&#28779;&#22681;**&#65288;&#20165;&#20801;&#35768; SSH + Tailscale &#31471;&#21475;&#65289;\n3. **Docker CE + Compose V2**&#65288;&#29992;&#20110;&#26234;&#33021;&#20307;&#27801;&#31665;&#65289;\n4. **Node.js 22.x + pnpm**&#65288;&#36816;&#34892;&#26102;&#20381;&#36182;&#65289;\n5. **OpenClaw**&#65288;&#22522;&#20110;&#20027;&#26426;&#65292;&#38750;&#23481;&#22120;&#21270;&#65289;\n6. **Systemd &#26381;&#21153;**&#65288;&#24102;&#23433;&#20840;&#21152;&#22266;&#30340;&#33258;&#21160;&#21551;&#21160;&#65289;\n\n&#27880;&#24847;&#65306;Gateway &#32593;&#20851;**&#30452;&#25509;&#22312;&#20027;&#26426;&#19978;&#36816;&#34892;**&#65288;&#19981;&#22312; Docker &#20013;&#65289;&#65292;&#20294;&#26234;&#33021;&#20307;&#27801;&#31665;&#20351;&#29992; Docker &#36827;&#34892;&#38548;&#31163;&#12290;&#35814;&#24773;&#21442;&#35265;[&#27801;&#31665;&#38548;&#31163;](\/gateway\/sandboxing)&#12290;\n\n## &#23433;&#35013;&#21518;&#35774;&#32622;\n\n&#23433;&#35013;&#23436;&#25104;&#21518;&#65292;&#20999;&#25442;&#21040; openclaw &#29992;&#25143;&#65306;\n\n```bash  theme={\"theme\":{\"light\":\"min-light\",\"dark\":\"min-dark\"}}\nsudo -i -u openclaw\n<\/code><\/pre>\n<p>&#23433;&#35013;&#21518;&#33050;&#26412;&#23558;&#24341;&#23548;&#20320;&#23436;&#25104;&#65306;<\/p>\n<ol>\n<li><strong>&#26032;&#25163;&#24341;&#23548;&#21521;&#23548;<\/strong>&#65306;&#37197;&#32622; OpenClaw &#35774;&#32622;<\/li>\n<li><strong>&#25552;&#20379;&#21830;&#30331;&#24405;<\/strong>&#65306;&#36830;&#25509; WhatsApp\/Telegram\/Discord\/Signal<\/li>\n<li><strong>Gateway &#32593;&#20851;&#27979;&#35797;<\/strong>&#65306;&#39564;&#35777;&#23433;&#35013;<\/li>\n<li><strong>Tailscale &#35774;&#32622;<\/strong>&#65306;&#36830;&#25509;&#21040;&#20320;&#30340; VPN mesh<\/li>\n<\/ol>\n<h3>&#24120;&#29992;&#21629;&#20196;<\/h3>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<\/p>\n<h1>&#26816;&#26597;&#26381;&#21153;&#29366;&#24577;<\/h1>\n<p>sudo systemctl status openclaw<\/p>\n<h1>&#26597;&#30475;&#23454;&#26102;&#26085;&#24535;<\/h1>\n<p>sudo journalctl -u openclaw -f<\/p>\n<h1>&#37325;&#21551; Gateway &#32593;&#20851;<\/h1>\n<p>sudo systemctl restart openclaw<\/p>\n<h1>&#25552;&#20379;&#21830;&#30331;&#24405;&#65288;&#20197; openclaw &#29992;&#25143;&#36816;&#34892;&#65289;<\/h1>\n<p>sudo -i -u openclaw<br \/>\nopenclaw channels login<\/p>\n<pre><code>\n## &#23433;&#20840;&#26550;&#26500;\n\n### 4 &#23618;&#38450;&#24481;\n\n1. **&#38450;&#28779;&#22681;&#65288;UFW&#65289;**&#65306;&#20165;&#20844;&#24320;&#26292;&#38706; SSH&#65288;22&#65289;+ Tailscale&#65288;41641\/udp&#65289;\n2. **VPN&#65288;Tailscale&#65289;**&#65306;Gateway &#32593;&#20851;&#20165;&#36890;&#36807; VPN mesh &#21487;&#35775;&#38382;\n3. **Docker &#38548;&#31163;**&#65306;DOCKER-USER iptables &#38142;&#38450;&#27490;&#22806;&#37096;&#31471;&#21475;&#26292;&#38706;\n4. **Systemd &#21152;&#22266;**&#65306;NoNewPrivileges&#12289;PrivateTmp&#12289;&#38750;&#29305;&#26435;&#29992;&#25143;\n\n### &#39564;&#35777;\n\n&#27979;&#35797;&#22806;&#37096;&#25915;&#20987;&#38754;&#65306;\n\n```bash  theme={\"theme\":{\"light\":\"min-light\",\"dark\":\"min-dark\"}}\nnmap -p- YOUR_SERVER_IP\n<\/code><\/pre>\n<p>&#24212;&#35813;&#26174;&#31034;<strong>&#20165;&#31471;&#21475; 22<\/strong>&#65288;SSH&#65289;&#24320;&#25918;&#12290;&#25152;&#26377;&#20854;&#20182;&#26381;&#21153;&#65288;Gateway &#32593;&#20851;&#12289;Docker&#65289;&#37117;&#34987;&#38145;&#23450;&#12290;<\/p>\n<h3>Docker &#21487;&#29992;&#24615;<\/h3>\n<p>Docker &#29992;&#20110;<strong>&#26234;&#33021;&#20307;&#27801;&#31665;<\/strong>&#65288;&#38548;&#31163;&#30340;&#24037;&#20855;&#25191;&#34892;&#65289;&#65292;&#32780;&#19981;&#26159;&#29992;&#20110;&#36816;&#34892; Gateway &#32593;&#20851;&#26412;&#36523;&#12290;Gateway &#32593;&#20851;&#20165;&#32465;&#23450;&#21040; localhost&#65292;&#36890;&#36807; Tailscale VPN &#35775;&#38382;&#12290;<\/p>\n<p>&#27801;&#31665;&#37197;&#32622;&#21442;&#35265;<a href=\"\/tools\/multi-agent-sandbox-tools\">&#22810;&#26234;&#33021;&#20307;&#27801;&#31665;&#19982;&#24037;&#20855;<\/a>&#12290;<\/p>\n<h2>&#25163;&#21160;&#23433;&#35013;<\/h2>\n<p>&#22914;&#26524;&#20320;&#26356;&#21916;&#27426;&#25163;&#21160;&#25511;&#21046;&#32780;&#38750;&#33258;&#21160;&#21270;&#65306;<\/p>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<\/p>\n<h1>1. &#23433;&#35013;&#20808;&#20915;&#26465;&#20214;<\/h1>\n<p>sudo apt update &amp;&amp; sudo apt install -y ansible git<\/p>\n<h1>2. &#20811;&#38534;&#20179;&#24211;<\/h1>\n<p>git clone https:\/\/github.com\/openclaw\/openclaw-ansible.git<br \/>\ncd openclaw-ansible<\/p>\n<h1>3. &#23433;&#35013; Ansible collections<\/h1>\n<p>ansible-galaxy collection install -r requirements.yml<\/p>\n<h1>4. &#36816;&#34892; playbook<\/h1>\n<p>.\/run-playbook.sh<\/p>\n<h1>&#25110;&#30452;&#25509;&#36816;&#34892;&#65288;&#28982;&#21518;&#25163;&#21160;&#25191;&#34892; \/tmp\/openclaw-setup.sh&#65289;<\/h1>\n<h1>ansible-playbook playbook.yml &#8211;ask-become-pass<\/h1>\n<pre><code>\n## &#26356;&#26032; OpenClaw\n\nAnsible &#23433;&#35013;&#31243;&#24207;&#35774;&#32622; OpenClaw &#20026;&#25163;&#21160;&#26356;&#26032;&#12290;&#26631;&#20934;&#26356;&#26032;&#27969;&#31243;&#21442;&#35265;[&#26356;&#26032;](\/install\/updating)&#12290;\n\n&#35201;&#37325;&#26032;&#36816;&#34892; Ansible playbook&#65288;&#20363;&#22914;&#65292;&#29992;&#20110;&#37197;&#32622;&#26356;&#25913;&#65289;&#65306;\n\n```bash  theme={\"theme\":{\"light\":\"min-light\",\"dark\":\"min-dark\"}}\ncd openclaw-ansible\n.\/run-playbook.sh\n<\/code><\/pre>\n<p>&#27880;&#24847;&#65306;&#36825;&#26159;&#24130;&#31561;&#30340;&#65292;&#21487;&#20197;&#23433;&#20840;&#22320;&#22810;&#27425;&#36816;&#34892;&#12290;<\/p>\n<h2>&#25925;&#38556;&#25490;&#38500;<\/h2>\n<h3>&#38450;&#28779;&#22681;&#38459;&#27490;&#20102;&#25105;&#30340;&#36830;&#25509;<\/h3>\n<p>&#22914;&#26524;&#20320;&#34987;&#38145;&#23450;&#65306;<\/p>\n<ul>\n<li>&#35831;&#30830;&#20445;&#20320;&#21487;&#20197;&#20808;&#36890;&#36807; Tailscale VPN &#35775;&#38382;<\/li>\n<li>SSH &#35775;&#38382;&#65288;&#31471;&#21475; 22&#65289;&#22987;&#32456;&#20801;&#35768;<\/li>\n<li>Gateway &#32593;&#20851;<strong>&#20165;<\/strong>&#36890;&#36807; Tailscale &#35775;&#38382;&#65292;&#36825;&#26159;&#35774;&#35745;&#22914;&#27492;<\/li>\n<\/ul>\n<h3>&#26381;&#21153;&#26080;&#27861;&#21551;&#21160;<\/h3>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<\/p>\n<h1>&#26816;&#26597;&#26085;&#24535;<\/h1>\n<p>sudo journalctl -u openclaw -n 100<\/p>\n<h1>&#39564;&#35777;&#26435;&#38480;<\/h1>\n<p>sudo ls -la \/opt\/openclaw<\/p>\n<h1>&#27979;&#35797;&#25163;&#21160;&#21551;&#21160;<\/h1>\n<p>sudo -i -u openclaw<br \/>\ncd ~\/openclaw<br \/>\npnpm start<\/p>\n<pre><code>\n### Docker &#27801;&#31665;&#38382;&#39064;\n\n```bash  theme={\"theme\":{\"light\":\"min-light\",\"dark\":\"min-dark\"}}\n# &#39564;&#35777; Docker &#27491;&#22312;&#36816;&#34892;\nsudo systemctl status docker\n\n# &#26816;&#26597;&#27801;&#31665;&#38236;&#20687;\nsudo docker images | grep openclaw-sandbox\n\n# &#22914;&#26524;&#32570;&#22833;&#21017;&#26500;&#24314;&#27801;&#31665;&#38236;&#20687;\ncd \/opt\/openclaw\/openclaw\nsudo -u openclaw .\/scripts\/sandbox-setup.sh\n<\/code><\/pre>\n<h3>&#25552;&#20379;&#21830;&#30331;&#24405;&#22833;&#36133;<\/h3>\n<p>&#35831;&#30830;&#20445;&#20320;&#20197; <code>openclaw<\/code> &#29992;&#25143;&#36816;&#34892;&#65306;<\/p>\n<p><code>bash  theme={\"theme\":{\"light\":\"min-light\",\"dark\":\"min-dark\"}}<br \/>\nsudo -i -u openclaw<br \/>\nopenclaw channels login<\/code><\/p>\n<h2>&#39640;&#32423;&#37197;&#32622;<\/h2>\n<p>&#35814;&#32454;&#30340;&#23433;&#20840;&#26550;&#26500;&#21644;&#25925;&#38556;&#25490;&#38500;&#65306;<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/openclaw\/openclaw-ansible\/blob\/main\/docs\/security.md\">&#23433;&#20840;&#26550;&#26500;<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/openclaw\/openclaw-ansible\/blob\/main\/docs\/architecture.md\">&#25216;&#26415;&#35814;&#24773;<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/openclaw\/openclaw-ansible\/blob\/main\/docs\/troubleshooting.md\">&#25925;&#38556;&#25490;&#38500;&#25351;&#21335;<\/a><\/li>\n<\/ul>\n<h2>&#30456;&#20851;&#20869;&#23481;<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/openclaw\/openclaw-ansible\">openclaw-ansible<\/a> &mdash; &#23436;&#25972;&#37096;&#32626;&#25351;&#21335;<\/li>\n<li><a href=\"\/install\/docker\">Docker<\/a> &mdash; &#23481;&#22120;&#21270; Gateway &#32593;&#20851;&#35774;&#32622;<\/li>\n<li><a href=\"\/gateway\/sandboxing\">&#27801;&#31665;&#38548;&#31163;<\/a> &mdash; &#26234;&#33021;&#20307;&#27801;&#31665;&#37197;&#32622;<\/li>\n<li><a href=\"\/tools\/multi-agent-sandbox-tools\">&#22810;&#26234;&#33021;&#20307;&#27801;&#31665;&#19982;&#24037;&#20855;<\/a> &mdash; &#27599;&#20010;&#26234;&#33021;&#20307;&#30340;&#38548;&#31163;<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Ansible Ansible &#23433;&#35013; &#23558; OpenClaw &#038;#37 [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-153","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=153"}],"version-history":[{"count":2,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":788,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/153\/revisions\/788"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}