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] 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_names', 'name': 'hosts:name',
'ip': ['hosts_ips', 'ip'], 'ip': ['hosts:ip', 'ip'],
'ssh_user': 'ssh_user', 'ssh_user': 'ssh_user',
'ssh_key': 'ssh_key' 'ssh_key': 'ssh_key'
}) })
signals.connect(node2, hosts2, { signals.connect(node2, hosts2, {
'name': 'hosts_names', 'name': 'hosts:name',
'ip': ['hosts_ips', 'ip'], 'ip': ['hosts:ip', 'ip'],
'ssh_user': 'ssh_user', 'ssh_user': 'ssh_user',
'ssh_key': 'ssh_key' 'ssh_key': 'ssh_key'
}) })
signals.connect(node1, hosts2, { signals.connect(node1, hosts2, {
'ip': 'hosts_ips', 'name': 'hosts:name',
'name': 'hosts_names' 'ip': 'hosts:ip',
}) })
signals.connect(node2, hosts1, { signals.connect(node2, hosts1, {
'ip': 'hosts_ips', 'name': 'hosts:name',
'name': 'hosts_names' 'ip': 'hosts:ip',
}) })

View File

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

View File

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

View File

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