hosts example is now using recent hash changes

This commit is contained in:
Jedrzej Nowak 2015-09-16 11:49:51 +02:00
parent 2cd5d948c2
commit 98352143fc
4 changed files with 15 additions and 19 deletions

View File

@ -29,27 +29,27 @@ def run():
hosts1 = vr.create('hosts_file1', 'resources/hosts_file', {})[0]
hosts2 = vr.create('hosts_file2', 'resources/hosts_file', {})[0]
signals.connect(node1, hosts1, {
'name': 'hosts_names',
'ip': ['hosts_ips', 'ip'],
'name': 'hosts:name',
'ip': ['hosts:ip', 'ip'],
'ssh_user': 'ssh_user',
'ssh_key': 'ssh_key'
})
signals.connect(node2, hosts2, {
'name': 'hosts_names',
'ip': ['hosts_ips', 'ip'],
'name': 'hosts:name',
'ip': ['hosts:ip', 'ip'],
'ssh_user': 'ssh_user',
'ssh_key': 'ssh_key'
})
signals.connect(node1, hosts2, {
'ip': 'hosts_ips',
'name': 'hosts_names'
'name': 'hosts:name',
'ip': 'hosts:ip',
})
signals.connect(node2, hosts1, {
'ip': 'hosts_ips',
'name': 'hosts_names'
'name': 'hosts:name',
'ip': 'hosts:ip',
})

View File

@ -195,7 +195,7 @@ def setup_haproxies():
local_errors = validation.validate_resource(r)
if local_errors:
has_errors = True
print 'ERROR: %s: %s' % (r.name, errors)
print 'ERROR: %s: %s' % (r.name, local_errors)
if has_errors:
print "ERRORS"

View File

@ -1,11 +1,11 @@
- hosts: [{{host}}]
sudo: yes
tasks:
{% for ip, host in zip(hosts_ips, hosts_names) %}
- name: Create hosts entries for {{host}} => {{ip}}
{% for val in hosts %}
- name: Create hosts entries for {{val['name']}} => {{val['ip']}}
lineinfile:
dest: /etc/hosts
regexp: '.*{{host}}$'
line: '{{ip}} {{host}}'
regexp: '.*{{val['name']}}$'
line: '{{val['ip']}} {{val['name']}}'
state: present
{% endfor %}

View File

@ -12,9 +12,5 @@ input:
ssh_user:
schema: str!
value:
hosts_names:
schema: [str!]
value: []
hosts_ips:
schema: [str!]
value: []
hosts:
schema: [{name: str!, ip: str!}]