Create YAML configuration from a Jinja2 template
(hostname, host_vars, codename)
| 97 | return yaml.safe_load(stream) |
| 98 | |
| 99 | def create_host_string(hostname, host_vars, codename): |
| 100 | """ |
| 101 | Create YAML configuration from a Jinja2 template |
| 102 | """ |
| 103 | if "portforwards" not in host_vars: |
| 104 | host_vars["portforwards"] = [] |
| 105 | return Environment().from_string(HOST_TEMPLATE).render( |
| 106 | name=hostname, |
| 107 | codename=codename, |
| 108 | ip_address=host_vars["address"], |
| 109 | portforwards=host_vars["portforwards"]) |
| 110 | |
| 111 | def create_ssh_config(hosts, codename): |
| 112 | """ |