collection 교체

This commit is contained in:
정훈 변
2024-02-23 16:37:40 +09:00
parent b494779b5b
commit 3fd554eee9
38862 changed files with 220204 additions and 6600073 deletions

View File

@@ -44,6 +44,7 @@ Parameters
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
/ <span style="color: purple">elements=raw</span>
/ <span style="color: red">required</span>
</div>
</td>
@@ -90,7 +91,9 @@ Parameters
<td>
</td>
<td>
<div>When the data provided is a list of dictionaries, run the test against this dictionary key. When using a <em>key</em>, the <em>data</em> must only contain dictionaries. See <em>fail_on_missing</em> below to determine the behaviour when the <em>key</em> is missing from a dictionary in the <em>data</em>.</div>
<div>When the data provided is a list of dictionaries, run the test against this dictionary key.</div>
<div>When using a <em>key</em>, the <em>data</em> must only contain dictionaries.</div>
<div>See <em>fail_on_missing</em> below to determine the behaviour when the <em>key</em> is missing from a dictionary in the <em>data</em>.</div>
</td>
</tr>
<tr>
@@ -108,7 +111,9 @@ Parameters
<td>
</td>
<td>
<div>The name of the test to run against the list, a valid jinja2 test or ansible test plugin. Jinja2 includes the following tests <a href='http://jinja.palletsprojects.com/templates/#builtin-tests'>http://jinja.palletsprojects.com/templates/#builtin-tests</a>. An overview of tests included in ansible <a href='https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html'>https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html</a>.</div>
<div>The name of the test to run against the list, a valid jinja2 test or ansible test plugin.</div>
<div>Jinja2 includes the following tests <a href='http://jinja.palletsprojects.com/templates/#builtin-tests'>http://jinja.palletsprojects.com/templates/#builtin-tests</a>.</div>
<div>An overview of tests included in ansible <a href='https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html'>https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html</a>.</div>
</td>
</tr>
<tr>
@@ -125,7 +130,9 @@ Parameters
<td>
</td>
<td>
<div>The value used to test each list item against. Not required for simple tests (eg: <code>true</code>, <code>false</code>, <code>even</code>, <code>odd</code>) May be a <code>string</code>, <code>boolean</code>, <code>number</code>, <code>regular expression</code> <code>dict</code> and so on, depending on the <b>test</b> used.</div>
<div>The value used to test each list item against.</div>
<div>Not required for simple tests (e.g. <code>true</code>, <code>false</code>, <code>even</code>, <code>odd</code>)</div>
<div>May be a <code>string</code>, <code>boolean</code>, <code>number</code>, <code>regular expression</code> <code>dict</code> and so on, depending on the <b>test</b> used.</div>
</td>
</tr>
<tr>
@@ -146,7 +153,10 @@ Parameters
<td>
</td>
<td>
<div>When only a single entry in the <em>data</em> is matched, the index of that entry is returned as an integer. If set to <code>True</code>, the return value will always be a list, even if only a single entry is matched. This can also be accomplished using <code>query</code> or <code>q</code> instead of <code>lookup</code>. <a href='https://docs.ansible.com/ansible/latest/plugins/lookup.html'>https://docs.ansible.com/ansible/latest/plugins/lookup.html</a></div>
<div>When only a single entry in the <em>data</em> is matched, the index of that entry is returned as an integer.</div>
<div>If set to <code>True</code>, the return value will always be a list, even if only a single entry is matched.</div>
<div>This can also be accomplished using <code>query</code> or <code>q</code> instead of <code>lookup</code>.</div>
<div><a href='https://docs.ansible.com/ansible/latest/plugins/lookup.html'>https://docs.ansible.com/ansible/latest/plugins/lookup.html</a></div>
</td>
</tr>
</table>
@@ -164,9 +174,9 @@ Examples
- ansible.builtin.set_fact:
data:
- 1
- 2
- 3
- 1
- 2
- 3
- name: Find the index of 2
ansible.builtin.set_fact:
@@ -234,14 +244,14 @@ Examples
- ansible.builtin.set_fact:
data:
- name: sw01.example.lan
type: switch
- name: rtr01.example.lan
type: router
- name: fw01.example.corp
type: firewall
- name: fw02.example.corp
type: firewall
- name: sw01.example.lan
type: switch
- name: rtr01.example.lan
type: router
- name: fw01.example.corp
type: firewall
- name: fw02.example.corp
type: firewall
- name: Find the index of all firewalls using the type key
ansible.builtin.set_fact:
@@ -272,7 +282,7 @@ Examples
msg: "The device named {{ data[item].name }} is a {{ data[item].type }}"
loop: "{{ lookup('ansible.utils.index_of', data, 'regex', expression, 'name') }}"
vars:
expression: '\.corp$' # ends with .corp
expression: '\.corp$'
# TASK [Find the index of all devices with a .corp name] *********************
# ok: [nxos101] => (item=2) =>
@@ -306,10 +316,10 @@ Examples
vars:
found: []
ip: '192.168.101.'
address: "{{ lookup('ansible.utils.index_of', item.1.ipv4|d([]), 'search', ip, 'address', wantlist=True) }}"
address: "{{ lookup('ansible.utils.index_of', item.1.ipv4 | d([]), 'search', ip, 'address', wantlist=True) }}"
entry:
- interface_idx: "{{ item.0 }}"
address_idxs: "{{ address }}"
- interface_idx: "{{ item.0 }}"
address_idxs: "{{ address }}"
when: address
# TASK [debug] ***************************************************************
@@ -340,8 +350,8 @@ Examples
interface:
- config:
description: configured by Ansible - 1
enabled: True
loopback-mode: False
enabled: true
loopback-mode: false
mtu: 1024
name: loopback0000
type: eth
@@ -350,18 +360,18 @@ Examples
subinterface:
- config:
description: subinterface configured by Ansible - 1
enabled: True
enabled: true
index: 5
index: 5
- config:
description: subinterface configured by Ansible - 2
enabled: False
enabled: false
index: 2
index: 2
- config:
description: configured by Ansible - 2
enabled: False
loopback-mode: False
enabled: false
loopback-mode: false
mtu: 2048
name: loopback1111
type: virt
@@ -370,12 +380,12 @@ Examples
subinterface:
- config:
description: subinterface configured by Ansible - 3
enabled: True
enabled: true
index: 10
index: 10
- config:
description: subinterface configured by Ansible - 4
enabled: False
enabled: false
index: 3
index: 3