hosts file example ported to new transports

This commit is contained in:
Jedrzej Nowak 2015-09-24 18:25:35 +02:00
parent 8e1f370fe4
commit 8af1500bd9
2 changed files with 6 additions and 17 deletions

View File

@ -14,32 +14,20 @@ db = get_db()
def run(): def run():
db.clear() db.clear()
node1 = vr.create('node1', 'resources/ro_node', {'name': 'first' + str(time.time()), resources = vr.create('nodes', 'templates/nodes_with_transports.yaml', {'count': 2})
'ip': '10.0.0.3', nodes = [x for x in resources if x.name.startswith('node')]
'ssh_key': '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key', node1, node2 = nodes
'ssh_user': 'vagrant'})[0]
node2 = vr.create('node2', 'resources/ro_node', {'name': 'second' + str(time.time()),
'ip': '10.0.0.4',
'ssh_key': '/vagrant/.vagrant/machines/solar-dev2/virtualbox/private_key',
'ssh_user': 'vagrant'})[0]
hosts1 = vr.create('hosts_file1', 'resources/hosts_file', {})[0] hosts1 = vr.create('hosts_file1', 'resources/hosts_file', {})[0]
hosts2 = vr.create('hosts_file2', 'resources/hosts_file', {})[0] hosts2 = vr.create('hosts_file2', 'resources/hosts_file', {})[0]
signals.connect(node1, hosts1, { signals.connect(node1, hosts1, {
'name': 'hosts:name', 'name': 'hosts:name',
'ip': ['hosts:ip', 'ip'], 'ip': 'hosts:ip',
'ssh_user': 'ssh_user',
'ssh_key': 'ssh_key'
}) })
signals.connect(node2, hosts2, { signals.connect(node2, hosts2, {
'name': 'hosts:name', 'name': 'hosts:name',
'ip': ['hosts:ip', 'ip'], 'ip': 'hosts:ip',
'ssh_user': 'ssh_user',
'ssh_key': 'ssh_key'
}) })
signals.connect(node1, hosts2, { signals.connect(node1, hosts2, {

View File

@ -18,4 +18,5 @@ resources:
values: values:
ip: '10.0.0.{{i + 3}}' ip: '10.0.0.{{i + 3}}'
transports_id: transports{{i}}::transports_id transports_id: transports{{i}}::transports_id
name: node{{i}}
{% endfor %} {% endfor %}