doc: update ansible.md (#31) 04e6e16a97

This commit is contained in:
jaywcjlove
2022-11-09 03:57:17 +00:00
parent e640be7d26
commit ceac94963d
3 changed files with 22 additions and 17 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 548 KiB

After

Width:  |  Height:  |  Size: 575 KiB

View File

@ -41,7 +41,7 @@
<p>此快速参考备忘单提供了使用 <a href="https://ansible.com">Ansible</a> 的各种方法。</p>
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" href="#安装">安装</a><a aria-hidden="true" class="leve3 tocs-link" href="#配置位置">配置位置</a><a aria-hidden="true" class="leve3 tocs-link" href="#inventory文件hosts列表">Inventory文件(hosts列表)</a><a aria-hidden="true" class="leve4 tocs-link" href="#静态inventory">静态Inventory</a><a aria-hidden="true" class="leve2 tocs-link" href="#命令行ad-hoc">命令行(ad-hoc)</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible">ansible</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-命令帮助">Ansible 命令帮助</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-galaxy-工具">Ansible Galaxy 工具</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-doc">ansible-doc</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-vault">ansible-vault</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-playbook">ansible-playbook</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-pull">ansible-pull</a><a aria-hidden="true" class="leve2 tocs-link" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" href="#安装">安装</a><a aria-hidden="true" class="leve3 tocs-link" href="#配置位置">配置位置</a><a aria-hidden="true" class="leve3 tocs-link" href="#inventory文件hosts列表">Inventory文件(hosts列表)</a><a aria-hidden="true" class="leve4 tocs-link" href="#静态inventory">静态Inventory</a><a aria-hidden="true" class="leve3 tocs-link" href="#inventory-主机组使用多个ip和域名">Inventory 主机组使用多个IP和域名</a><a aria-hidden="true" class="leve3 tocs-link" href="#inventory-主机组使用子主机组">Inventory 主机组使用子主机组</a><a aria-hidden="true" class="leve3 tocs-link" href="#给多台主机设置变量">给多台主机设置变量</a><a aria-hidden="true" class="leve2 tocs-link" href="#命令行ad-hoc">命令行(ad-hoc)</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible">ansible</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-命令帮助">Ansible 命令帮助</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-galaxy-工具">Ansible Galaxy 工具</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-doc">ansible-doc</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-vault">ansible-vault</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-playbook">ansible-playbook</a><a aria-hidden="true" class="leve3 tocs-link" href="#ansible-pull">ansible-pull</a><a aria-hidden="true" class="leve2 tocs-link" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="安装"><a aria-hidden="true" tabindex="-1" href="#安装"><span class="icon icon-link"></span></a>安装</h3><div class="wrap-body">
@ -100,23 +100,24 @@
</span><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">webservers</span><span class="token punctuation">]</span></span>
</span><span class="code-line">foo.example.com
</span><span class="code-line">bar.example.com
</span><span class="code-line">
</span><span class="code-line">Inventory主机组使用多个IP和域名
</span><span class="code-line"> <span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">web</span><span class="token punctuation">]</span></span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="inventory-主机组使用多个ip和域名"><a aria-hidden="true" tabindex="-1" href="#inventory-主机组使用多个ip和域名"><span class="icon icon-link"></span></a>Inventory 主机组使用多个IP和域名</h3><div class="wrap-body">
<pre><code class="code-highlight"><span class="code-line">[web]
</span><span class="code-line">172.18.12.5[1:4]
</span><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">webservers</span><span class="token punctuation">]</span></span>
</span><span class="code-line">[webservers]
</span><span class="code-line">www[01:50].example.com
</span><span class="code-line">
</span><span class="code-line">Inventory主机组使用子主机组
</span><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">usa:children</span><span class="token punctuation">]</span></span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="inventory-主机组使用子主机组"><a aria-hidden="true" tabindex="-1" href="#inventory-主机组使用子主机组"><span class="icon icon-link"></span></a>Inventory 主机组使用子主机组</h3><div class="wrap-body">
<pre class="language-ini"><code class="language-ini code-highlight"><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">usa:children</span><span class="token punctuation">]</span></span>
</span><span class="code-line">southeast
</span><span class="code-line">northeast
</span><span class="code-line">southwest
</span><span class="code-line">northwest
</span><span class="code-line">
</span><span class="code-line">给多台主机设置变量 : group variables
</span><span class="code-line">如果组中的所有主机共享一个变量值,则可以一次将该变量应用于整个组
</span><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">atlanta</span><span class="token punctuation">]</span></span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="给多台主机设置变量"><a aria-hidden="true" tabindex="-1" href="#给多台主机设置变量"><span class="icon icon-link"></span></a>给多台主机设置变量</h3><div class="wrap-body">
<p><code>group variables</code>
如果组中的所有主机共享一个变量值,则可以一次将该变量应用于整个组</p>
<pre class="language-ini"><code class="language-ini code-highlight"><span class="code-line"><span class="token section"><span class="token punctuation">[</span><span class="token section-name selector">atlanta</span><span class="token punctuation">]</span></span>
</span><span class="code-line">host1
</span><span class="code-line">host2
</span><span class="code-line">

View File

@ -44,7 +44,7 @@
<p>这是 TOML 格式配置文件语法的快速参考备忘清单。</p>
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" href="#介绍">介绍</a><a aria-hidden="true" class="leve3 tocs-link" href="#示例">示例</a><a aria-hidden="true" class="leve3 tocs-link" href="#注释">注释</a><a aria-hidden="true" class="leve3 tocs-link" href="#整数">整数</a><a aria-hidden="true" class="leve3 tocs-link" href="#浮点数">浮点数</a><a aria-hidden="true" class="leve3 tocs-link" href="#布尔值">布尔值</a><a aria-hidden="true" class="leve3 tocs-link" href="#时间日期">时间日期</a><a aria-hidden="true" class="leve3 tocs-link" href="#字符串">字符串</a><a aria-hidden="true" class="leve3 tocs-link" href="#table">Table</a><a aria-hidden="true" class="leve3 tocs-link" href="#数组">数组</a><a aria-hidden="true" class="leve3 tocs-link" href="#友好数组">友好数组</a><a aria-hidden="true" class="leve2 tocs-link" href="#toml-字符串">TOML 字符串</a><a aria-hidden="true" class="leve3 tocs-link" href="#多行字符串">多行字符串</a><a aria-hidden="true" class="leve3 tocs-link" href="#文字字符串">文字字符串</a><a aria-hidden="true" class="leve3 tocs-link" href="#多行文字字符串">多行文字字符串</a><a aria-hidden="true" class="leve2 tocs-link" href="#toml-tables">TOML Tables</a><a aria-hidden="true" class="leve3 tocs-link" href="#基本的">基本的</a><a aria-hidden="true" class="leve3 tocs-link" href="#嵌套">嵌套</a><a aria-hidden="true" class="leve3 tocs-link" href="#类数组">类数组</a><a aria-hidden="true" class="leve4 tocs-link" href="#-等效的-json">↓ 等效的 JSON</a><a aria-hidden="true" class="leve3 tocs-link" href="#点分隔">点分隔</a><a aria-hidden="true" class="leve4 tocs-link" href="#-等效的-json-1">↓ 等效的 JSON</a><a aria-hidden="true" class="leve3 tocs-link" href="#多嵌套">多嵌套</a><a aria-hidden="true" class="leve4 tocs-link" href="#-等效的-json-2">↓ 等效的 JSON</a><a aria-hidden="true" class="leve3 tocs-link" href="#忽略空格">忽略空格</a><a aria-hidden="true" class="leve3 tocs-link" href="#inline-table">Inline Table</a><a aria-hidden="true" class="leve2 tocs-link" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" href="#入门">入门</a><a aria-hidden="true" class="leve3 tocs-link" href="#介绍">介绍</a><a aria-hidden="true" class="leve3 tocs-link" href="#示例">示例</a><a aria-hidden="true" class="leve3 tocs-link" href="#注释">注释</a><a aria-hidden="true" class="leve3 tocs-link" href="#整数">整数</a><a aria-hidden="true" class="leve3 tocs-link" href="#浮点数">浮点数</a><a aria-hidden="true" class="leve3 tocs-link" href="#布尔值">布尔值</a><a aria-hidden="true" class="leve3 tocs-link" href="#时间日期">时间日期</a><a aria-hidden="true" class="leve3 tocs-link" href="#字符串">字符串</a><a aria-hidden="true" class="leve3 tocs-link" href="#table">Table</a><a aria-hidden="true" class="leve3 tocs-link" href="#数组">数组</a><a aria-hidden="true" class="leve3 tocs-link" href="#友好数组">友好数组</a><a aria-hidden="true" class="leve2 tocs-link" href="#toml-字符串">TOML 字符串</a><a aria-hidden="true" class="leve3 tocs-link" href="#多行字符串">多行字符串</a><a aria-hidden="true" class="leve3 tocs-link" href="#文字字符串">文字字符串</a><a aria-hidden="true" class="leve3 tocs-link" href="#多行文字字符串">多行文字字符串</a><a aria-hidden="true" class="leve2 tocs-link" href="#toml-tables">TOML Tables</a><a aria-hidden="true" class="leve3 tocs-link" href="#基本的">基本的</a><a aria-hidden="true" class="leve3 tocs-link" href="#嵌套">嵌套</a><a aria-hidden="true" class="leve3 tocs-link" href="#类数组">类数组</a><a aria-hidden="true" class="leve4 tocs-link" href="#-等效的-json">↓ 等效的 JSON</a><a aria-hidden="true" class="leve3 tocs-link" href="#点分隔">点分隔</a><a aria-hidden="true" class="leve4 tocs-link" href="#-等效的-json-1">↓ 等效的 JSON</a><a aria-hidden="true" class="leve3 tocs-link" href="#多嵌套">多嵌套</a><a aria-hidden="true" class="leve4 tocs-link" href="#-等效的-json-2">↓ 等效的 JSON</a><a aria-hidden="true" class="leve3 tocs-link" href="#忽略空格">忽略空格</a><a aria-hidden="true" class="leve3 tocs-link" href="#内联表">内联表</a><a aria-hidden="true" class="leve2 tocs-link" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="入门"><a aria-hidden="true" tabindex="-1" href="#入门"><span class="icon icon-link"></span></a>入门</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="介绍"><a aria-hidden="true" tabindex="-1" href="#介绍"><span class="icon icon-link"></span></a>介绍</h3><div class="wrap-body">
<p><a href="https://toml.io/en/">TOML</a> 是一种最小的配置文件格式,由于明显的语义而易于阅读。</p>
<ul>
@ -211,7 +211,7 @@
</span><span class="code-line"><span class="token punctuation">[</span> <span class="token table class-name">g . h .i</span> <span class="token punctuation">]</span> <span class="token comment"># same as [g.h.i]</span>
</span><span class="code-line"><span class="token punctuation">[</span> <span class="token table class-name">j . "ʞ" .'l'</span> <span class="token punctuation">]</span> <span class="token comment"># same as [j."ʞ".'l']</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="inline-table"><a aria-hidden="true" tabindex="-1" href="#inline-table"><span class="icon icon-link"></span></a>Inline Table</h3><div class="wrap-body">
</div></div></div><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="内联表"><a aria-hidden="true" tabindex="-1" href="#内联表"><span class="icon icon-link"></span></a>内联表</h3><div class="wrap-body">
<!--rehype:wrap-class=col-span-2-->
<pre class="language-toml"><code class="language-toml code-highlight"><span class="code-line"><span class="token key property">name</span> <span class="token punctuation">=</span> <span class="token punctuation">{</span> <span class="token key property">first</span> <span class="token punctuation">=</span> <span class="token string">"Tom"</span><span class="token punctuation">,</span> <span class="token key property">last</span> <span class="token punctuation">=</span> <span class="token string">"Preston-Werner"</span> <span class="token punctuation">}</span>
</span><span class="code-line"><span class="token key property">point</span> <span class="token punctuation">=</span> <span class="token punctuation">{</span> <span class="token key property">x</span> <span class="token punctuation">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token key property">y</span> <span class="token punctuation">=</span> <span class="token number">2</span> <span class="token punctuation">}</span>