8000 GitHub - jeremyschulman/ansible-csv2hosts: Demo - CSV to Ansible 'hosts' and 'host_vars' · GitHub
[go: up one dir, main page]

Skip to content
{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2Fgithub.com%2Fjeremyschulman%2Fansible-csv2hosts","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E\u0026source=header-repo\u0026source_repo=jeremyschulman%2Fansible-csv2hosts","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://github.com/jeremyschulman/ansible-csv2hosts\",\"user_id\":null}}","auth_hydro_click_hmac":"92c91a6919f8c5b412f89a37cf1e96f1fe4bcdc0d198ca06b80699f2df92d058"}}

About

Demo - CSV to Ansible 'hosts' and 'host_vars'

Resources

Stars

21 stars

Watchers

4 watching

Forks

Repository files navigation

ansible-csv2hosts

Demo - CSV to Ansible 'hosts' and 'host_vars'

Demo

To create the hosts and host_vars files:

user@linux> python csv2hosts.py

The demo is hardcoded to use the CSV file called 'data.csv'.

To run the Ansible playbook to template build a file for each host:

user@linux> ansible-playbook build_conf -i hosts

The output of the ansible run should look like this:

[jeremy@stargate ansible-csv2hosts]$ ansible-playbook -i hosts build_conf 

PLAY [all] ******************************************************************** 

TASK: [building config] ******************************************************* 
changed: [twb-sf-rtr1]
changed: [twb-sf-rtr2]

PLAY RECAP ******************************************************************** 
twb-sf-rtr1                : ok=1    changed=1    unreachable=0    failed=0   
twb-sf-rtr2                : ok=1    changed=1    unreachable=0    failed=0   

Clean-up

The demo repository includes the files created after the demo as run. If you want to remove everything that was built by the demo, do the following:

user@linux> rm hosts
user@linux> rm host_vars/*
user@linux> rm *.conf

Then re-run the demo

About

Demo - CSV to Ansible 'hosts' and 'host_vars'

Resources

Stars

21 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages

0