mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Added (Define Values From CSV File) to example section (#46620)
Adding a new example demonstrating setting facts from a CSV file, from a real-world network use case.
This commit is contained in:
parent
39e71bb7ce
commit
84a40b71c2
1 changed files with 11 additions and 0 deletions
|
@ -39,6 +39,17 @@ EXAMPLES = """
|
|||
|
||||
- name: msg="Match 'Li' on the first column, but return the 3rd column (columns start counting after the match)"
|
||||
debug: msg="The atomic mass of Lithium is {{ lookup('csvfile', 'Li file=elements.csv delimiter=, col=2') }}"
|
||||
|
||||
- name: Define Values From CSV File
|
||||
set_fact:
|
||||
loop_ip: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=1') }}"
|
||||
int_ip: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=2') }}"
|
||||
int_mask: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=3') }}"
|
||||
int_name: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=4') }}"
|
||||
local_as: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=5') }}"
|
||||
neighbor_as: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=6') }}"
|
||||
neigh_int_ip: "{{ lookup('csvfile', bgp_neighbor_ip +' file=bgp_neighbors.csv delimiter=, col=7') }}"
|
||||
delegate_to: localhost
|
||||
"""
|
||||
|
||||
RETURN = """
|
||||
|
|
Loading…
Reference in a new issue