Merge pull request #178 from pigmej/transports_as_resource

transports as resources.
This commit is contained in:
Łukasz Oleś 2015-09-25 13:42:53 +02:00
commit 72bb891f0e
64 changed files with 422 additions and 387 deletions

View File

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

View File

@ -54,7 +54,10 @@ def setup_resources():
if PROFILE:
pr.enable()
node1, node2 = vr.create('nodes', 'templates/nodes.yaml', {})
resources = vr.create('nodes', 'templates/nodes_with_transports.yaml', {"count": 2})
nodes = [x for x in resources if x.name.startswith('node')]
node1, node2 = nodes
# MARIADB
mariadb_service1 = vr.create('mariadb_service1', 'resources/mariadb_service', {
@ -247,8 +250,6 @@ def setup_resources():
signals.connect(neutron_keystone_user, neutron_keystone_role)
signals.connect(keystone_puppet, neutron_keystone_service_endpoint, {
'ip': ['ip', 'keystone_host'],
'ssh_key': 'ssh_key',
'ssh_user': 'ssh_user',
'admin_port': 'keystone_admin_port',
'admin_token': 'admin_token',
})
@ -352,7 +353,6 @@ def setup_resources():
signals.connect(cinder_keystone_user, cinder_puppet, {'user_name': 'keystone_user', 'tenant_name': 'keystone_tenant', 'user_password': 'keystone_password'})
signals.connect(mariadb_service1, cinder_puppet, {'ip':'ip'})
signals.connect(cinder_puppet, cinder_keystone_service_endpoint, {
'ssh_key': 'ssh_key', 'ssh_user': 'ssh_user',
'ip': ['ip', 'keystone_host', 'admin_ip', 'internal_ip', 'public_ip'],
'port': ['admin_port', 'internal_port', 'public_port'],})
signals.connect(keystone_puppet, cinder_keystone_service_endpoint, {
@ -447,8 +447,7 @@ def setup_resources():
signals.connect(nova_puppet, nova_keystone_service_endpoint, {
'ip': ['ip', 'keystone_host', 'public_ip', 'internal_ip', 'admin_ip'],
'port': ['admin_port', 'internal_port', 'public_port'],
'ssh_key': 'ssh_key',
'ssh_user': 'ssh_user'})
})
# NOVA API
nova_api_puppet = vr.create('nova_api_puppet', 'resources/nova_api_puppet', {})[0]
@ -561,7 +560,6 @@ def setup_resources():
'user_password': 'keystone_password'})
signals.connect(mariadb_service1, glance_api_puppet, {'ip':'ip'})
signals.connect(glance_api_puppet, glance_keystone_service_endpoint, {
'ssh_key': 'ssh_key', 'ssh_user': 'ssh_user',
'ip': ['ip', 'keystone_host', 'admin_ip', 'internal_ip', 'public_ip'],
'bind_port': ['admin_port', 'internal_port', 'public_port'],})
signals.connect(keystone_puppet, glance_keystone_service_endpoint, {

3
examples/riak/riaks.py Normal file → Executable file
View File

@ -32,7 +32,8 @@ db = get_db()
def setup_riak():
db.clear()
nodes = vr.create('nodes', 'templates/riak_nodes.yaml', {})
resources = vr.create('nodes', 'templates/riak_nodes.yaml', {'count': 3})
nodes = [x for x in resources if x.name.startswith('node')]
node1, node2, node3 = nodes
riak_services = []

View File

@ -5,12 +5,12 @@ input:
ip:
type: str!
value:
ssh_user:
type: str!
value:
ssh_key:
type: str!
value:
# ssh_user:
# type: str!
# value:
# ssh_key:
# type: str!
# value:
default1:
type: str!
value: meta

View File

@ -176,11 +176,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/apache_service, resources/apache]

View File

@ -68,11 +68,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/cinder_api_service, resources/cinder_api, resources/cinder]

View File

@ -26,12 +26,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
glance_api_servers_port:
schema: int

View File

@ -201,11 +201,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/cinder_service, resources/cinder]

View File

@ -17,11 +17,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/cinder_scheduler_service, resources/cinder_scheduler, resources/cinder]

View File

@ -30,11 +30,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/cinder_volume_service, resources/cinder_volume, resources/cinder]

View File

@ -6,12 +6,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
networks:
schema: {}
value:

View File

@ -6,11 +6,11 @@ input:
ip:
schema: str!
value:
ssh_user:
schema: str!
value:
ssh_key:
schema: str!
value:
# ssh_user:
# schema: str!
# value:
# ssh_key:
# schema: str!
# value:
tags: [resources/docker]

View File

@ -17,11 +17,11 @@ input:
volume_binds:
schema: [{src: str, dst: str, mode: str}]
value: []
ssh_user:
schema: str!
value: []
ssh_key:
schema: str!
value: []
# ssh_user:
# schema: str!
# value: []
# ssh_key:
# schema: str!
# value: []
tags: [resource/container]

View File

@ -17,12 +17,12 @@ input:
volume_binds:
schema: [{src: str, dst: str, mode: str}]
value: []
ssh_user:
schema: str!
value: []
ssh_key:
schema: str!
value: []
# ssh_user:
# schema: str!
# value: []
# ssh_key:
# schema: str!
# value: []
db_password:
schema: str!

View File

@ -5,12 +5,12 @@ input:
ip:
schema: str!
value:
ssh_user:
schema: str!
value: []
ssh_key:
schema: str!
value: []
# ssh_user:
# schema: str!
# value: []
# ssh_key:
# schema: str!
# value: []
config_dir:
schema: {src: str!, dst: str!, mode: str}

View File

@ -131,12 +131,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
db_user:
schema: str!

View File

@ -95,12 +95,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
db_user:
schema: str!

View File

@ -17,11 +17,11 @@ input:
volume_binds:
schema: [{src: str, dst: str, mode: str}]
value: []
ssh_user:
schema: str!
value: []
ssh_key:
schema: str!
value: []
# ssh_user:
# schema: str!
# value: []
# ssh_key:
# schema: str!
# value: []
tags: [resource/container]

View File

@ -11,11 +11,11 @@ input:
config:
schema: [{backends: [{server: str!, port: int!}], listen_port: int!, protocol: str!, name: str!}]
value: []
ssh_user:
schema: str!
value:
ssh_key:
schema: str!
value:
# ssh_user:
# schema: str!
# value:
# ssh_key:
# schema: str!
# value:
tags: [resources/haproxy, resource/haproxy_config]

View File

@ -5,11 +5,11 @@ input:
ip:
schema: str!
value:
ssh_user:
schema: str!
value:
ssh_key:
schema: str!
value:
# ssh_user:
# schema: str!
# value:
# ssh_key:
# schema: str!
# value:
tags: [resources/haproxy, resource/haproxy_service]

View File

@ -3,14 +3,5 @@ handler: ansible
version: 1.0.0
input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
hosts:
schema: [{name: str!, ip: str!}]

View File

@ -27,11 +27,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/keystone_config, resources/keystone]

View File

@ -37,11 +37,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/keystone_service, resources/keystone]

View File

@ -23,11 +23,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/keystone_role, resources/keystone]

View File

@ -17,11 +17,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/keystone_service, resources/keystone]

View File

@ -52,11 +52,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/keystone_service_endpoint, resources/keystone]

View File

@ -17,11 +17,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/keystone_tenant, resources/keystone]

View File

@ -23,11 +23,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/keystone_user, resources/keystone]

View File

@ -6,12 +6,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
ansible_ssh_host:
schema: str!
value:

View File

@ -6,12 +6,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
provides:
schema: str
value: infra

View File

@ -31,9 +31,9 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:

View File

@ -17,11 +17,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/mariadb_service, resources/mariadb]

View File

@ -32,9 +32,9 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
package_ensure:
schema: str

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
package_ensure:
schema: str

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
auth_password:
schema: str!

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
package_ensure:
schema: str

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
type_drivers:
schema: [str]

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
package_ensure:
schema: str

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
db_user:
schema: str!

View File

@ -101,11 +101,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/nova_api_service, resources/nova_api, resources/nova]

View File

@ -53,11 +53,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/nova_compute_libvirt_service, resources/nova_compute_libvirt, resources/nova_compute, resources/nova]

View File

@ -74,11 +74,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/nova_compute_service, resources/nova_compute, resources/nova]

View File

@ -17,11 +17,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/nova_conductor_service, resources/nova_conductor, resources/nova]

View File

@ -23,11 +23,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/nova_generic_service, resources/nova]

View File

@ -84,11 +84,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/nova_neutron_service, resources/nova_neutron, resources/nova_compute, resources/nova]

View File

@ -240,11 +240,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/nova_service, resources/nova]

View File

@ -21,9 +21,9 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:

View File

@ -14,9 +14,9 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
port:
schema: int!

View File

@ -17,11 +17,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resources/rabbitmq, resource/rabbitmq_user]

View File

@ -8,11 +8,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resources/rabbitmq, resource/rabbitmq_vhost]

View File

@ -10,9 +10,9 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:

View File

@ -2,8 +2,8 @@
sudo: yes
tasks:
# those below are mostly for tests
# - shell: killall -u riak
# ignore_errors: yes
- shell: killall -u riak
ignore_errors: yes
# remove above when non tests
# we install ubuntu repo there,

View File

@ -9,12 +9,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
riak_self_name:
schema: str!
value:

View File

@ -6,12 +6,16 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
name:
schema: str
value:
value: a node
location_id:
schema: str!
value: $uuid
reverse: True

View File

@ -4,12 +4,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
master_ip:
schema: str!

View File

@ -6,12 +6,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
keys_dir:
schema: str!
value:

View File

@ -0,0 +1,18 @@
id: transport_ssh
input:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
ssh_port:
schema: int!
value: 22
name:
schema: str!
value: ssh
location_id:
schema: str!
value:
reverse: True

View File

@ -0,0 +1,13 @@
id: transports
input:
transports:
schema: [{user: str, password: str, port: int!, key: str, name: str!}]
value: []
transports_id:
schema: str!
value: $uuid
reverse: True
location_id:
schema: str!
value:
reverse: True

View File

@ -17,11 +17,11 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
tags: [resource/volume_group]

View File

@ -6,12 +6,12 @@ input:
ip:
schema: str!
value:
ssh_key:
schema: str!
value:
ssh_user:
schema: str!
value:
# ssh_key:
# schema: str!
# value:
# ssh_user:
# schema: str!
# value:
parent:
schema: str!
value:

View File

@ -0,0 +1,22 @@
id: simple_multinode_with_transports
resources:
{% for i in range(count|int) %}
- id: ssh_transport{{i}}
from: resources/transport_ssh
values:
ssh_user: 'vagrant'
ssh_key: '/vagrant/.vagrant/machines/solar-dev{{i + 1}}/virtualbox/private_key'
- id: transports{{i}}
from: resources/transports
values:
transports:key: ssh_transport{{i}}::ssh_key
transports:user: ssh_transport{{i}}::ssh_user
transports:port: ssh_transport{{i}}::ssh_port
transports:name: ssh_transport{{i}}::name
- id: node{{i}}
from: resources/ro_node
values:
ip: '10.0.0.{{i + 3}}'
transports_id: transports{{i}}::transports_id
name: node{{i}}
{% endfor %}

View File

@ -1,23 +1,23 @@
id: simple_riak_cluster
id: simple_riak_with_transports
resources:
- id: node1
{% for i in range(count|int) %}
{% set j = i +1 %}
- id: ssh_transport{{j}}
from: resources/transport_ssh
values:
ssh_user: 'vagrant'
ssh_key: '/vagrant/.vagrant/machines/solar-dev{{j}}/virtualbox/private_key'
- id: transports{{j}}
from: resources/transports
values:
transports:key: ssh_transport{{j}}::ssh_key
transports:user: ssh_transport{{j}}::ssh_user
transports:port: ssh_transport{{j}}::ssh_port
transports:name: ssh_transport{{j}}::name
- id: node{{j}}
from: resources/ro_node
values:
ip: '10.0.0.3'
name: 'node1'
ssh_key: '/vagrant/.vagrant/machines/solar-dev1/virtualbox/private_key'
ssh_user: 'vagrant'
- id: node2
from: resources/ro_node
values:
ip: '10.0.0.4'
name: 'node2'
ssh_key: '/vagrant/.vagrant/machines/solar-dev2/virtualbox/private_key'
ssh_user: 'vagrant'
- id: node3
from: resources/ro_node
values:
ip: '10.0.0.5'
name: 'node3'
ssh_key: '/vagrant/.vagrant/machines/solar-dev3/virtualbox/private_key'
ssh_user: 'vagrant'
name: node{{j}}
ip: '10.0.0.{{i + 3}}'
transports_id: transports{{j}}::transports_id
{% endfor %}