Skip to content

Commit 97ead48

Browse files
author
github-actions
committed
Docs build 2025-01-03
1 parent 9126006 commit 97ead48

File tree

6 files changed

+20
-30
lines changed

6 files changed

+20
-30
lines changed

en/latest/_sources/inventory-data.rst.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ By default, pyinfra assumes hosts are SSH servers and the name of the host is us
88
Inventory Files
99
---------------
1010

11-
Inventory files contain groups of hosts. Groups are defined as a ``list``. For example, this inventory creates two groups, ``app_servers`` and ``db_servers``:
11+
Inventory files contain groups of hosts. Groups are defined as a ``list`` or ``tuple``. For example, this inventory creates two groups, ``app_servers`` and ``db_servers``:
1212

1313
.. code:: python
1414
@@ -17,19 +17,17 @@ Inventory files contain groups of hosts. Groups are defined as a ``list``. For e
1717
"app-2.net"
1818
]
1919
20-
db_servers = [
21-
"db-1.net",
22-
"db-2.net",
23-
"db-3.net",
24-
]
20+
db_servers = (["db-1.net", "db-2.net", "db-3.net",], {})
2521
26-
If you save this file as ``inventory.py``, you can then use it in when executing pyinfra:
22+
If you save this file as ``inventory.py``, you can then use it when executing pyinfra:
2723

2824
.. code:: shell
2925
3026
pyinfra inventory.py OPERATIONS...
3127
3228
.. Note::
29+
Group names starting with a leading ``_`` are intentionally ignored.
30+
3331
In addition to the groups defined in the inventory, all the hosts are added to a group with the name of the inventory file (eg ``production.py`` becomes ``production``).
3432

3533
Limiting inventory at runtime

en/latest/inventory-data.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,22 @@ <h1>Inventory &amp; Data<a class="headerlink" href="#inventory-data" title="Perm
151151
<p>By default, pyinfra assumes hosts are SSH servers and the name of the host is used as the SSH hostname. Prefixing the name of the host with <code class="docutils literal notranslate"><span class="pre">&#64;&lt;connector-name&gt;/</span></code> is used to activate alternative connectors. See: <a class="reference internal" href="connectors.html"><span class="doc">Connectors Index</span></a>.</p>
152152
<div class="section" id="inventory-files">
153153
<h2>Inventory Files<a class="headerlink" href="#inventory-files" title="Permalink to this heading"></a></h2>
154-
<p>Inventory files contain groups of hosts. Groups are defined as a <code class="docutils literal notranslate"><span class="pre">list</span></code>. For example, this inventory creates two groups, <code class="docutils literal notranslate"><span class="pre">app_servers</span></code> and <code class="docutils literal notranslate"><span class="pre">db_servers</span></code>:</p>
154+
<p>Inventory files contain groups of hosts. Groups are defined as a <code class="docutils literal notranslate"><span class="pre">list</span></code> or <code class="docutils literal notranslate"><span class="pre">tuple</span></code>. For example, this inventory creates two groups, <code class="docutils literal notranslate"><span class="pre">app_servers</span></code> and <code class="docutils literal notranslate"><span class="pre">db_servers</span></code>:</p>
155155
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">app_servers</span> <span class="o">=</span> <span class="p">[</span>
156156
<span class="s2">&quot;app-1.net&quot;</span><span class="p">,</span>
157157
<span class="s2">&quot;app-2.net&quot;</span>
158158
<span class="p">]</span>
159159

160-
<span class="n">db_servers</span> <span class="o">=</span> <span class="p">[</span>
161-
<span class="s2">&quot;db-1.net&quot;</span><span class="p">,</span>
162-
<span class="s2">&quot;db-2.net&quot;</span><span class="p">,</span>
163-
<span class="s2">&quot;db-3.net&quot;</span><span class="p">,</span>
164-
<span class="p">]</span>
160+
<span class="n">db_servers</span> <span class="o">=</span> <span class="p">([</span><span class="s2">&quot;db-1.net&quot;</span><span class="p">,</span> <span class="s2">&quot;db-2.net&quot;</span><span class="p">,</span> <span class="s2">&quot;db-3.net&quot;</span><span class="p">,],</span> <span class="p">{})</span>
165161
</pre></div>
166162
</div>
167-
<p>If you save this file as <code class="docutils literal notranslate"><span class="pre">inventory.py</span></code>, you can then use it in when executing pyinfra:</p>
163+
<p>If you save this file as <code class="docutils literal notranslate"><span class="pre">inventory.py</span></code>, you can then use it when executing pyinfra:</p>
168164
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pyinfra<span class="w"> </span>inventory.py<span class="w"> </span>OPERATIONS...
169165
</pre></div>
170166
</div>
171167
<div class="admonition note">
172168
<p class="first admonition-title">Note</p>
169+
<p>Group names starting with a leading <code class="docutils literal notranslate"><span class="pre">_</span></code> are intentionally ignored.</p>
173170
<p class="last">In addition to the groups defined in the inventory, all the hosts are added to a group with the name of the inventory file (eg <code class="docutils literal notranslate"><span class="pre">production.py</span></code> becomes <code class="docutils literal notranslate"><span class="pre">production</span></code>).</p>
174171
</div>
175172
</div>

en/latest/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

en/next/_sources/inventory-data.rst.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ By default, pyinfra assumes hosts are SSH servers and the name of the host is us
88
Inventory Files
99
---------------
1010

11-
Inventory files contain groups of hosts. Groups are defined as a ``list``. For example, this inventory creates two groups, ``app_servers`` and ``db_servers``:
11+
Inventory files contain groups of hosts. Groups are defined as a ``list`` or ``tuple``. For example, this inventory creates two groups, ``app_servers`` and ``db_servers``:
1212

1313
.. code:: python
1414
@@ -17,19 +17,17 @@ Inventory files contain groups of hosts. Groups are defined as a ``list``. For e
1717
"app-2.net"
1818
]
1919
20-
db_servers = [
21-
"db-1.net",
22-
"db-2.net",
23-
"db-3.net",
24-
]
20+
db_servers = (["db-1.net", "db-2.net", "db-3.net",], {})
2521
26-
If you save this file as ``inventory.py``, you can then use it in when executing pyinfra:
22+
If you save this file as ``inventory.py``, you can then use it when executing pyinfra:
2723

2824
.. code:: shell
2925
3026
pyinfra inventory.py OPERATIONS...
3127
3228
.. Note::
29+
Group names starting with a leading ``_`` are intentionally ignored.
30+
3331
In addition to the groups defined in the inventory, all the hosts are added to a group with the name of the inventory file (eg ``production.py`` becomes ``production``).
3432

3533
Limiting inventory at runtime

en/next/inventory-data.html

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,22 @@ <h1>Inventory &amp; Data<a class="headerlink" href="#inventory-data" title="Perm
151151
<p>By default, pyinfra assumes hosts are SSH servers and the name of the host is used as the SSH hostname. Prefixing the name of the host with <code class="docutils literal notranslate"><span class="pre">&#64;&lt;connector-name&gt;/</span></code> is used to activate alternative connectors. See: <a class="reference internal" href="connectors.html"><span class="doc">Connectors Index</span></a>.</p>
152152
<div class="section" id="inventory-files">
153153
<h2>Inventory Files<a class="headerlink" href="#inventory-files" title="Permalink to this heading"></a></h2>
154-
<p>Inventory files contain groups of hosts. Groups are defined as a <code class="docutils literal notranslate"><span class="pre">list</span></code>. For example, this inventory creates two groups, <code class="docutils literal notranslate"><span class="pre">app_servers</span></code> and <code class="docutils literal notranslate"><span class="pre">db_servers</span></code>:</p>
154+
<p>Inventory files contain groups of hosts. Groups are defined as a <code class="docutils literal notranslate"><span class="pre">list</span></code> or <code class="docutils literal notranslate"><span class="pre">tuple</span></code>. For example, this inventory creates two groups, <code class="docutils literal notranslate"><span class="pre">app_servers</span></code> and <code class="docutils literal notranslate"><span class="pre">db_servers</span></code>:</p>
155155
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">app_servers</span> <span class="o">=</span> <span class="p">[</span>
156156
<span class="s2">&quot;app-1.net&quot;</span><span class="p">,</span>
157157
<span class="s2">&quot;app-2.net&quot;</span>
158158
<span class="p">]</span>
159159

160-
<span class="n">db_servers</span> <span class="o">=</span> <span class="p">[</span>
161-
<span class="s2">&quot;db-1.net&quot;</span><span class="p">,</span>
162-
<span class="s2">&quot;db-2.net&quot;</span><span class="p">,</span>
163-
<span class="s2">&quot;db-3.net&quot;</span><span class="p">,</span>
164-
<span class="p">]</span>
160+
<span class="n">db_servers</span> <span class="o">=</span> <span class="p">([</span><span class="s2">&quot;db-1.net&quot;</span><span class="p">,</span> <span class="s2">&quot;db-2.net&quot;</span><span class="p">,</span> <span class="s2">&quot;db-3.net&quot;</span><span class="p">,],</span> <span class="p">{})</span>
165161
</pre></div>
166162
</div>
167-
<p>If you save this file as <code class="docutils literal notranslate"><span class="pre">inventory.py</span></code>, you can then use it in when executing pyinfra:</p>
163+
<p>If you save this file as <code class="docutils literal notranslate"><span class="pre">inventory.py</span></code>, you can then use it when executing pyinfra:</p>
168164
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>pyinfra<span class="w"> </span>inventory.py<span class="w"> </span>OPERATIONS...
169165
</pre></div>
170166
</div>
171167
<div class="admonition note">
172168
<p class="first admonition-title">Note</p>
169+
<p>Group names starting with a leading <code class="docutils literal notranslate"><span class="pre">_</span></code> are intentionally ignored.</p>
173170
<p class="last">In addition to the groups defined in the inventory, all the hosts are added to a group with the name of the inventory file (eg <code class="docutils literal notranslate"><span class="pre">production.py</span></code> becomes <code class="docutils literal notranslate"><span class="pre">production</span></code>).</p>
174171
</div>
175172
</div>

en/next/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)