Use id instead of mac
This commit is contained in:
parent
35580bd3f4
commit
917d9e0f7c
@ -20,12 +20,12 @@ class NodeAdapter(dict):
|
|||||||
raise AttributeError(name)
|
raise AttributeError(name)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def safe_mac(self):
|
def node_id(self):
|
||||||
return self['mac'].replace(':', '_')
|
return self['id']
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def partitioning(self):
|
def partitioning(self):
|
||||||
return requests.get(bareon_service.format(self['mac'])).json()
|
return requests.get(bareon_service.format(self['id'])).json()
|
||||||
|
|
||||||
# Sync hw info about nodes from discovery service into bareon-api
|
# Sync hw info about nodes from discovery service into bareon-api
|
||||||
requests.post(bareon_sync)
|
requests.post(bareon_sync)
|
||||||
@ -42,11 +42,11 @@ master_node = filter(lambda n: n.name == 'node_master', node_resources)[0]
|
|||||||
# Dnsmasq resources
|
# Dnsmasq resources
|
||||||
for node in nodes_list:
|
for node in nodes_list:
|
||||||
node = NodeAdapter(node)
|
node = NodeAdapter(node)
|
||||||
node_resource = filter(lambda n: n.name.endswith('node_{0}'.format(node.safe_mac)), node_resources)[0]
|
node_resource = filter(lambda n: n.name.endswith('node_{0}'.format(node.node_id)), node_resources)[0]
|
||||||
|
|
||||||
node_resource.update({'partitioning': node.partitioning})
|
node_resource.update({'partitioning': node.partitioning})
|
||||||
|
|
||||||
dnsmasq = vr.create('dnsmasq_{0}'.format(node.safe_mac), 'resources/dnsmasq', {})[0]
|
dnsmasq = vr.create('dnsmasq_{0}'.format(node.node_id), 'resources/dnsmasq', {})[0]
|
||||||
master_node.connect(dnsmasq)
|
master_node.connect(dnsmasq)
|
||||||
node_resource.connect(dnsmasq, {'admin_mac': 'exclude_mac_pxe'})
|
node_resource.connect(dnsmasq, {'admin_mac': 'exclude_mac_pxe'})
|
||||||
|
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
id: not_provisioned_nodes
|
id: not_provisioned_nodes
|
||||||
resources:
|
resources:
|
||||||
{% for node in nodes %}
|
{% for node in nodes %}
|
||||||
{% set mac = node.mac | replace(':', '_') %}
|
{% set id = node.id | replace(':', '_') %}
|
||||||
- id: ssh_transport{{ mac }}
|
- id: ssh_transport{{ id }}
|
||||||
from: resources/transport_ssh
|
from: resources/transport_ssh
|
||||||
values:
|
values:
|
||||||
ssh_user: 'root'
|
ssh_user: 'root'
|
||||||
ssh_key: '/vagrant/tmp/keys/ssh_private'
|
ssh_key: '/vagrant/tmp/keys/ssh_private'
|
||||||
- id: transports{{mac}}
|
- id: transports{{id}}
|
||||||
from: resources/transports
|
from: resources/transports
|
||||||
values:
|
values:
|
||||||
transports:key: ssh_transport{{mac}}::ssh_key
|
transports:key: ssh_transport{{id}}::ssh_key
|
||||||
transports:user: ssh_transport{{mac}}::ssh_user
|
transports:user: ssh_transport{{id}}::ssh_user
|
||||||
transports:port: ssh_transport{{mac}}::ssh_port
|
transports:port: ssh_transport{{id}}::ssh_port
|
||||||
transports:name: ssh_transport{{mac}}::name
|
transports:name: ssh_transport{{id}}::name
|
||||||
- id: node_{{mac}}
|
- id: node_{{id}}
|
||||||
from: resources/not_provisioned_node
|
from: resources/not_provisioned_node
|
||||||
values:
|
values:
|
||||||
ip: {{node.ip}}
|
ip: {{node.ip}}
|
||||||
transports_id: transports{{mac}}::transports_id
|
transports_id: transports{{id}}::transports_id
|
||||||
name: node_{{mac}}
|
name: node_{{id}}
|
||||||
admin_mac: {{node.mac}}
|
admin_mac: {{node.mac}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user