From d5b70900a9e37514cb48ff2679364da6c549423f Mon Sep 17 00:00:00 2001 From: Tim Kuhlman Date: Fri, 30 May 2014 16:50:54 -0600 Subject: [PATCH] Added keystone to mini-mon --- cookbooks/mini-mon/README.md | 1 + cookbooks/mini-mon/metadata.rb | 2 +- cookbooks/mini-mon/recipes/keystone.rb | 26 ++++++++++++++++++++++++++ roles/Mini-Mon.json | 1 + split/roles/Api.json | 3 ++- 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 cookbooks/mini-mon/recipes/keystone.rb diff --git a/cookbooks/mini-mon/README.md b/cookbooks/mini-mon/README.md index 8151d24..af84be3 100644 --- a/cookbooks/mini-mon/README.md +++ b/cookbooks/mini-mon/README.md @@ -9,5 +9,6 @@ apt cookbook Recipes --------- - default - configures base apt repostories needed for mini-mon as well as option apt cache +- keystone - simple keystone installation - mysql_schema - Defines the mysql_schema used by mini-mon - postfix - extremely simple postfix install diff --git a/cookbooks/mini-mon/metadata.rb b/cookbooks/mini-mon/metadata.rb index 73b58d5..bd375da 100644 --- a/cookbooks/mini-mon/metadata.rb +++ b/cookbooks/mini-mon/metadata.rb @@ -4,5 +4,5 @@ maintainer_email "hpcs-mon@hp.com" license "All rights reserved" description "Base setup for all vagrant boxes" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.0.4" +version "0.0.5" depends "apt" diff --git a/cookbooks/mini-mon/recipes/keystone.rb b/cookbooks/mini-mon/recipes/keystone.rb new file mode 100644 index 0000000..34d9f9c --- /dev/null +++ b/cookbooks/mini-mon/recipes/keystone.rb @@ -0,0 +1,26 @@ +# Install a simple keystone just using sqlite, then setup a user mini-mon/password + +package 'keystone' do + action :install +end + +service 'keystone' do + action [ :enable, :start ] +end + +# The python-keystoneclient that comes with precise is broken by a newer python-prettytable needed by python-monclient, so cmdline interaction is messed +# up, using the api directly is fine though + +python 'make default keystone user' do + action :run + code <<-EOH +from keystoneclient.v2_0 import client +import sys +key = client.Client(token='ADMIN', endpoint='http://127.0.0.1:35357/v2.0/') +for user in key.users.list(): + if user.name == 'mini-mon': + sys.exit(0) + +key.users.create(name='mini-mon', password='password', email='mini@mon.com', enabled=True) +EOH +end diff --git a/roles/Mini-Mon.json b/roles/Mini-Mon.json index 668aa2a..36c9a3e 100644 --- a/roles/Mini-Mon.json +++ b/roles/Mini-Mon.json @@ -38,6 +38,7 @@ "chef_type": "role", "run_list": [ "recipe[mini-mon]", + "recipe[mini-mon::keystone]", "recipe[percona::cluster]", "recipe[mini-mon::mysql_schema]", "recipe[zookeeper]", diff --git a/split/roles/Api.json b/split/roles/Api.json index 2aa6ea0..f8b8b54 100644 --- a/split/roles/Api.json +++ b/split/roles/Api.json @@ -9,7 +9,8 @@ "chef_type": "role", "run_list": [ "role[Basenode]", - "recipe[mon_api]" + "recipe[mon_api]", + "recipe[mini-mon::keystone]" ], "env_run_lists": { }