From 61566b6a6642b398650a93cba8efd7b77db26b33 Mon Sep 17 00:00:00 2001 From: Dmitry Shulyak Date: Fri, 9 Oct 2015 12:41:13 +0300 Subject: [PATCH] Implement library resource --- examples/library_ceph/ceph.py | 31 +++++++++++++++------------ resources/ceph_mon/meta.yaml | 3 --- resources/fuel_library/actions/run.sh | 20 +++++++++++++++++ resources/fuel_library/meta.yaml | 18 ++++++++++++++++ 4 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 resources/fuel_library/actions/run.sh create mode 100644 resources/fuel_library/meta.yaml diff --git a/examples/library_ceph/ceph.py b/examples/library_ceph/ceph.py index d89eb9a..60822a8 100644 --- a/examples/library_ceph/ceph.py +++ b/examples/library_ceph/ceph.py @@ -20,15 +20,15 @@ NETWORK_SCHEMA = { } NETWORK_METADATA = yaml.load(""" - node-1: + solar-dev1: uid: '1' - fqdn: node-1 + fqdn: solar-dev1 network_roles: ceph/public: 10.0.0.3 ceph/replication: 10.0.0.3 node_roles: - ceph-mon - name: node-1 + name: solar-dev1 """) @@ -38,17 +38,20 @@ def deploy(): resources = vr.create('nodes', 'templates/nodes.yaml', {'count': 1}) first_node = next(x for x in resources if x.name.startswith('node')) - ceph_mon = vr.create('ceph_mon1', 'resources/ceph_mon', - {'storage': STORAGE, - 'keystone': KEYSTONE, - 'network_scheme': NETWORK_SCHEMA, - 'ceph_monitor_nodes': NETWORK_METADATA, - 'ceph_primary_monitor_node': NETWORK_METADATA, - 'role': 'controller', - })[0] - first_node.connect(ceph_mon) - first_node.connect(ceph_mon, {'ip': 'public_vip'}) - first_node.connect(ceph_mon, {'ip': 'management_vip'}) + library = vr.create('library1', 'resources/fuel_library', {})[0] + first_node.connect(library) + + # TODO(use library resource) + # ceph_mon = vr.create('ceph_mon1', 'resources/ceph_mon', + # {'storage': STORAGE, + # 'keystone': KEYSTONE, + # 'network_scheme': NETWORK_SCHEMA, + # 'ceph_monitor_nodes': NETWORK_METADATA, + # 'ceph_primary_monitor_node': NETWORK_METADATA, + # 'role': 'controller', + # })[0] + # first_node.connect(ceph_mon, + # {'ip': ['ip', 'public_vip', 'management_vip']}) if __name__ == '__main__': diff --git a/resources/ceph_mon/meta.yaml b/resources/ceph_mon/meta.yaml index 3e4c322..ff79835 100644 --- a/resources/ceph_mon/meta.yaml +++ b/resources/ceph_mon/meta.yaml @@ -1,8 +1,6 @@ id: ceph_mon handler: puppet version: 1.0.0 - - input: library: schema: {repository: str!, branch: str!, puppet_modules: str} @@ -39,5 +37,4 @@ input: role: schema: str! value: - tags: [] diff --git a/resources/fuel_library/actions/run.sh b/resources/fuel_library/actions/run.sh new file mode 100644 index 0000000..e16245b --- /dev/null +++ b/resources/fuel_library/actions/run.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +mkdir -p {{temp_directory}} + +pushd {{temp_directory}} +if [ ! -d fuel-library ] +then + git clone -b {{ git['branch'] }} {{ git['repository'] }} +else + pushd ./fuel-library + git pull + popd +fi +pushd ./fuel-library/deployment +./update_modules.sh +popd + +mkdir -p {{puppet_modules}} +cp -r ./fuel-library/deployment/puppet/* {{puppet_modules}} +popd diff --git a/resources/fuel_library/meta.yaml b/resources/fuel_library/meta.yaml new file mode 100644 index 0000000..1d52103 --- /dev/null +++ b/resources/fuel_library/meta.yaml @@ -0,0 +1,18 @@ +id: fuel_library +handler: shell +version: 1.0.0 +input: + ip: + schema: str! + value: + git: + schema: {repository: str!, branch: str!} + value: {repository: 'https://github.com/stackforge/fuel-library', + branch: 'stable/7.0'} + temp_directory: + schema: str! + value: /tmp/solar + puppet_modules: + schema: str! + value: /etc/fuel/modules +tags: []