Refactor not_provisioned_nodes template

This commit is contained in:
Evgeniy L 2015-10-19 20:58:50 +03:00
parent 4c434ec247
commit 48fcd503b1
2 changed files with 11 additions and 10 deletions

View File

@ -26,7 +26,7 @@ master_node = filter(lambda n: n.name == 'node_master', node_resources)[0]
# Dnsmasq resources
for node in nodes_list:
dnsmasq = vr.create('dnsmasq_{0}'.format(node['mac'].replace(':', '_')), 'resources/dnsmasq', {})[0]
node = filter(lambda n: n.name.endswith('node{0}'.format(node['mac']).replace(':', '_')), node_resources)[0]
node = filter(lambda n: n.name.endswith('node_{0}'.format(node['mac']).replace(':', '_')), node_resources)[0]
master_node.connect(dnsmasq)
node.connect(dnsmasq, {'admin_mac': 'exclude_mac_pxe'})

View File

@ -1,24 +1,25 @@
id: not_provisioned_nodes
resources:
{% for node in nodes %}
- id: ssh_transport{{ node.mac | replace(':', '_') }}
{% set mac = node.mac | replace(':', '_') %}
- id: ssh_transport{{ mac }}
from: resources/transport_ssh
values:
ssh_user: 'root'
ssh_key: '/vagrant/tmp/keys/ssh_private'
- id: transports{{node.mac | replace(':', '_') }}
- id: transports{{mac}}
from: resources/transports
values:
transports:key: ssh_transport{{node.mac | replace(':', '_') }}::ssh_key
transports:user: ssh_transport{{node.mac | replace(':', '_') }}::ssh_user
transports:port: ssh_transport{{node.mac | replace(':', '_') }}::ssh_port
transports:name: ssh_transport{{node.mac | replace(':', '_') }}::name
- id: node{{node.mac | replace(':', '_') }}
transports:key: ssh_transport{{mac}}::ssh_key
transports:user: ssh_transport{{mac}}::ssh_user
transports:port: ssh_transport{{mac}}::ssh_port
transports:name: ssh_transport{{mac}}::name
- id: node_{{mac}}
from: resources/not_provisioned_node
values:
ip: {{node.ip}}
transports_id: transports{{node.mac | replace(':', '_') }}::transports_id
name: node{{node.mac | replace(':', '_') }}
transports_id: transports{{mac}}::transports_id
name: node_{{mac}}
admin_mac: {{node.mac}}
{% endfor %}