{"id":17028738,"url":"https://github.com/cmsirbu/gencfg","last_synced_at":"2026-02-24T01:32:47.027Z","repository":{"id":86108841,"uuid":"53054310","full_name":"cmsirbu/gencfg","owner":"cmsirbu","description":"A script that applies csv data to configuration templates (in jinja2 format)","archived":false,"fork":false,"pushed_at":"2017-03-13T16:35:05.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-28T10:06:39.395Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmsirbu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-03-03T13:59:21.000Z","updated_at":"2023-10-23T15:59:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ad87196-4ff8-431d-b997-51037aeb8477","html_url":"https://github.com/cmsirbu/gencfg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cmsirbu/gencfg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmsirbu%2Fgencfg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmsirbu%2Fgencfg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmsirbu%2Fgencfg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmsirbu%2Fgencfg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmsirbu","download_url":"https://codeload.github.com/cmsirbu/gencfg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmsirbu%2Fgencfg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29766443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T01:28:30.166Z","status":"ssl_error","status_checked_at":"2026-02-24T01:28:27.518Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T07:55:57.905Z","updated_at":"2026-02-24T01:32:46.999Z","avatar_url":"https://github.com/cmsirbu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gencfg\n\nA Python (works in both 2 and 3) script that applies csv data to configuration templates (in jinja2 format).\n\n## Requirements\n\n- [Python](https://www.python.org/)\n- [Jinja2](http://jinja.pocoo.org/)\n\nTo install dependencies, run `pip install -r requirements.txt` after cloning the repo (or `pip3` if running under python3).\n\n## Usage\n\nScript has two modes:\n\n1. Generate a `csv` header from a template file: `t.py csvheader -t template.j2`\n2. Generate device configuration based on a template and data: `t.py gencfg -t template.j2 -d data.csv`\n\nThe `csv` file MUST have a header row defining the variables used in the template and all of the variables must be present. Any extra columns will be ignored.\n\n## Example\n\nWith the template in `example.j2`:\n\n```\n!\nhostname {{ROUTER_HOSTNAME}}\n!\n!\nno ip domain lookup\nno ip http server\nno ip http secure-server\nip ssh source-interface Loopback0\nip ssh version 2\n!\n!\nip vrf {{VRF_NAME}}\n description {{CUSTOMER_NAME}} {{VRF_NAME}}\n!\n!\ninterface Loopback0\n description Management interface\n ip vrf forwarding {{VRF_NAME}}\n ip address {{PRIMARY_MGMT_LOOPBACK}} 255.255.255.255\n!\n```\n\nAnd data in `example.csv`:\n\n```\nID,CUSTOMER_NAME,PRIMARY_MGMT_LOOPBACK,ROUTER_HOSTNAME,VRF_NAME\n1,Mega Super Market,10.0.255.1,msmarket-brtr-1,MSM\n2,Mega Super Market,10.0.255.2,msmarket-brtr-2,MSM\n3,Mega Super Market,10.0.255.3,msmarket-brtr-3,MSM\n4,Mega Super Market,10.0.255.4,msmarket-brtr-4,MSM\n5,Mega Super Market,10.0.255.5,msmarket-brtr-5,MSM\n6,Mega Super Market,10.0.255.6,msmarket-brtr-6,MSM\n7,Mega Super Market,10.0.255.7,msmarket-brtr-7,MSM\n8,Mega Super Market,10.0.255.8,msmarket-brtr-8,MSM\n9,Mega Super Market,10.0.255.9,msmarket-brtr-9,MSM\n10,Mega Super Market,10.0.255.10,msmarket-brtr-10,MSM\n```\n\nThe result of running `t.py gencfg -t example.j2 -d example.csv` will be `10` files in the `config` subdirectory. For example, `cfg-4` will contain:\n\n```\n!\nhostname msmarket-brtr-4\n!\n!\nno ip domain lookup\nno ip http server\nno ip http secure-server\nip ssh source-interface Loopback0\nip ssh version 2\n!\n!\nip vrf MSM\n description Mega Super Market MSM\n!\n!\ninterface Loopback0\n description Management interface\n ip vrf forwarding MSM\n ip address 10.0.255.4 255.255.255.255\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmsirbu%2Fgencfg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmsirbu%2Fgencfg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmsirbu%2Fgencfg/lists"}