[chef] Separate role for each real server (virtual machine) ?


Chronological Thread 
  • From: Vladimir Skubriev < >
  • To:
  • Subject: [chef] Separate role for each real server (virtual machine) ?
  • Date: Thu, 12 Dec 2013 18:05:39 +0400

What do you think about separate role for each real server (virtual machine) ?


For example we have domain example.com,
nodes:
    server1.example.com,
    server2.example.com

We define a role for each of this server:

role[server1_example_com]
    runlist_of_role:    recipe[apt], recipe[sqlserver]

role[server2_example_com]
    runlist_of_role:    recipe[apt], recipe[mysqlserver]

And suppose I am use a custom script, which is set run list for each rule in chef-repo/roles/*example.com* role's node

#!/bin/bash

# This script setup node's run_list to role[_<node-fqdn-name>] for nodes with defined roles in ../roles directory.
# Only for roles beginning with _ (underline symbol)

# Define roles dir
# By default search a chef-repo/roles directory
CONFIGDIR="../roles"

for role in $CONFIGDIR/*example.com.rb*
do
        node=`basename $role | sed -r 's/^(.*)(.example.com.rb$)/\1/' `
knife node run_list set "$node.example.com" 'role['$node'.example.com"]'

done

In this case we does not worry about node's run_lists and nodes when reinstalling chef server.

Is i am right ?

And what do you think about one abstract role for one real server ?

--
Best regards,

CVision Lab System Administrator
Vladmir Skubriev




Archive powered by MHonArc 2.6.16.

§