Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcoca/ansible-csv_import
Role that maps csv file data into variables by matching a search term
https://github.com/bcoca/ansible-csv_import
Last synced: about 1 month ago
JSON representation
Role that maps csv file data into variables by matching a search term
- Host: GitHub
- URL: https://github.com/bcoca/ansible-csv_import
- Owner: bcoca
- License: gpl-3.0
- Created: 2024-04-17T17:34:39.000Z (8 months ago)
- Default Branch: devel
- Last Pushed: 2024-04-17T18:00:38.000Z (8 months ago)
- Last Synced: 2024-10-25T18:14:06.126Z (about 2 months ago)
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Simple role that maps a matching row in a CSV file to host variables
Use ``` ansible-doc -t role ``` for docs.
Example:
play.yml
```
- hosts: localhost
gather_facts: false
vars:
csv_file_name: testing.csv
tasks:
- import_role: name=csv_import
vars:
csv_search_term: '127.0.0.1'
```csv file 'testing.csv'
```
ip,net,mask,noword,her,him,second
127.0.0.1,10.0.0.1,24,nones,lola,pepe,127.0.0.2
128.0.0.1,10.1.0.1,20,notes,lolita,pepito,128.0.0.2
129.0.0.1,10.2.0.1,23,nines,aayush,pepete,129.0.0.2```
created variables:
```
"new_variables": {
"ip": "127.0.0.1"
"net": "10.0.0.1"
"mask": "24"
"noword": "nones"
"her": "lola"
"him": "pepe"
"second": "127.0.0.2"
},
```