From e575e02279319b871f092a955039d48aa299469e Mon Sep 17 00:00:00 2001 From: Dmitry Shulyak Date: Fri, 9 Oct 2015 13:15:23 +0300 Subject: [PATCH] Add ceph_keys resource --- examples/library_ceph/ceph.py | 2 ++ resources/ceph_keys/actions/run.sh | 17 +++++++++++++++++ resources/ceph_keys/meta.yaml | 14 ++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 resources/ceph_keys/actions/run.sh create mode 100644 resources/ceph_keys/meta.yaml diff --git a/examples/library_ceph/ceph.py b/examples/library_ceph/ceph.py index 60822a8..b0fe8b8 100644 --- a/examples/library_ceph/ceph.py +++ b/examples/library_ceph/ceph.py @@ -41,6 +41,8 @@ def deploy(): library = vr.create('library1', 'resources/fuel_library', {})[0] first_node.connect(library) + keys = vr.create('ceph_key', 'resources/ceph_keys', {})[0] + first_node.connect(keys) # TODO(use library resource) # ceph_mon = vr.create('ceph_mon1', 'resources/ceph_mon', # {'storage': STORAGE, diff --git a/resources/ceph_keys/actions/run.sh b/resources/ceph_keys/actions/run.sh new file mode 100644 index 0000000..7fa849c --- /dev/null +++ b/resources/ceph_keys/actions/run.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +BASE_PATH={{ target_directory }} +KEY_NAME={{ key_name }} + +function generate_ssh_keys { + local dir_path=$BASE_PATH$KEY_NAME/ + local key_path=$dir_path$KEY_NAME + mkdir -p $dir_path + if [ ! -f $key_path ]; then + ssh-keygen -b 2048 -t rsa -N '' -f $key_path 2>&1 + else + echo 'Key $key_path already exists' + fi +} + +generate_ssh_keys diff --git a/resources/ceph_keys/meta.yaml b/resources/ceph_keys/meta.yaml new file mode 100644 index 0000000..0cbb457 --- /dev/null +++ b/resources/ceph_keys/meta.yaml @@ -0,0 +1,14 @@ +id: ceph_keys +handler: shell +version: 1.0.0 +input: + ip: + schema: str! + value: + target_directory: + schema: str! + value: /var/lib/astute + key_name: + schema: str! + value: ceph +tags: []