Implement f2s/fsclient.py which will bootstrap solar stuff from fuel

This commit is contained in:
Dmitry Shulyak 2015-11-11 13:44:42 +02:00
parent 62ec081cb4
commit 2019c35843
6 changed files with 80 additions and 21 deletions

View File

@ -165,7 +165,9 @@ class DGroup(object):
yield OrderedDict(
[('id', RoleData.name+"{{index}}"),
('from', 'f2s/resources/'+RoleData.name),
('location', "{{node}}")])
('location', "{{node}}"),
('values', {'uid': '{{index}}',
'env': '{{env}}'})])
for t, _, _ in self.tasks:
if t.name in self.filtered:

View File

@ -2,14 +2,71 @@
import click
from solar.core.resource import virtual_resource as vr
@click.group()
def main():
pass
@click.command()
@click.parameter('nodes', nargs=-1)
def nodes(nodes):
from fuelclient.objects.node import Node
nodes_obj = map(Node, nodes)
class NailgunSource(object):
def nodes(self, uids):
from fuelclient.objects.node import Node
nodes_obj = map(Node, nodes)
return []
def roles(self, roles):
return []
class DumbSource(object):
def nodes(self, uids):
ip_mask = '10.0.0.%'
return [(uid, ip_mask % uid, 1) for uid in uids]
def roles(self, uid):
return 'primary-controller'
def master(self):
return 'master', '10.0.1.1'
source = DumbSource()
@click.command()
@click.parameter('uids', nargs=-1)
def nodes(uids):
master = source.master()
vr.create('master', 'f2s/vrs/fuel_node',
{'index': master[0], 'ip': master[1]})
for uid, ip, env in source.nodes(uids):
vr.create('fuel_node', 'f2s/vrs/fuel_node',
{'index': uid, 'ip': ip})
@click.command()
@click.parameter('uids', nargs=-1)
def basic(uids):
master_index = source.master()[0]
other = nodes_data[1:]
vr.create('genkeys', 'f2s/vrs/genkeys', {
'node': 'node'+master_index,
'index': master_index})
for uid, ip, env in source.nodes(uids):
vr.create('prep', 'f2s/vrs/prep',
{'index': uid, 'env': env, 'node': 'node'+uid})
@click.command()
@click.parameter('uids', nargs=-1)
def roles(uids):
for uid, ip, env in source.nodes(uids):
role = source.roles(uid)
vr.create(role, 'f2s/vrs/'+role,
{'index': uid, 'env': 'env', 'node': 'node'+uid})
if __name__ == '__main__':
main()

View File

@ -9,7 +9,7 @@ input:
# should be auto-generated based on outputs from globals.pp
puppet_modules:
type: str!
value:
value: /etc/puppet/modules
uid:
type: str!
value:

View File

@ -15,4 +15,4 @@ resources:
values:
name: node{{index}}
ip: {{ip}}
transports_id: transports{{j}}::transports_id
transports_id: transports{{index}}::transports_id

View File

@ -5,19 +5,19 @@ resources:
location: {{node}}
values:
sources:
- src: /var/lib/fuel/keys/{{uid}}/neutron/neutron.pub
- src: /var/lib/fuel/keys/{{env}}/neutron/neutron.pub
dst: /var/lib/astute/neutron/neutron.pub
- src: /var/lib/fuel/keys/{{uid}}/neutron/neutron
- src: /var/lib/fuel/keys/{{env}}/neutron/neutron
dst: /var/lib/astute/neutron/neutron
- src: /var/lib/fuel/keys/{uid}/nova/nova.pub
- src: /var/lib/fuel/keys/{{env}}/nova/nova.pub
dst: /var/lib/astute/nova/nova.pub
- src: /var/lib/fuel/keys/{{uid}}/nova/nova
- src: /var/lib/fuel/keys/{{env}}/nova/nova
dst: /var/lib/astute/nova/nova
- src: /var/lib/fuel/keys/{{uid}}/mysql/mysql.pub
- src: /var/lib/fuel/keys/{{env}}/mysql/mysql.pub
dst: /var/lib/astute/mysql/mysql.pub
- src: /var/lib/fuel/keys/{{uid}}/mysql/mysql
- src: /var/lib/fuel/keys/{{env}}/mysql/mysql
dst: /var/lib/astute/mysql/mysql
- src: /var/lib/fuel/keys/{{uid}}/mongodb/mongodb.key
- src: /var/lib/fuel/keys/{{env}}/mongodb/mongodb.key
dst: /var/lib/astute/mongodb/mongodb.key
- src: /etc/puppet/modules
dst: /etc/puppet/modules

View File

@ -6,8 +6,8 @@ resources:
values:
name: mos-holdback
package: '*'
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/7.0/ mos7.0-holdback main restricted
pin: release o=Mirantis,n=mos7.0,a=mos7.0-holdback,l=mos7.0
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/8.0/ mos8.0-holdback main restricted
pin: release o=Mirantis,n=mos8.0,a=mos8.0-holdback,l=mos8.0
pin_priority: 1100
- id: mos_security_{{index}}
from: resources/apt_repo
@ -15,8 +15,8 @@ resources:
values:
name: mos
package: '*'
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/7.0/ mos7.0-security main restricted
pin: release o=Mirantis,n=mos7.0,a=mos7.0-security,l=mos7.0
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/8.0/ mos8.0-security main restricted
pin: release o=Mirantis,n=mos8.0,a=mos8.0-security,l=mos8.0
pin_priority: 1050
- id: mos_updates_{{index}}
from: resources/apt_repo
@ -24,8 +24,8 @@ resources:
values:
name: mos_update
package: '*'
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/7.0/ mos7.0-updates main restricted
pin: release o=Mirantis,a=mos7.0-updates,l=mos7.0,n=mos7.0
repo: deb http://mirror.fuel-infra.org/mos-repos/ubuntu/8.0/ mos8.0-updates main restricted
pin: release o=Mirantis,a=mos8.0-updates,l=mos8.0,n=mos8.0
pin_priority: 1050
- id: managed_apt_{{index}}
from: resources/managed_apt