i have created a mongodb chef recipe, and i am overriding the default attributes on the recipe from the role.
name 'mongo_datanode_jackey'
description 'this module is currently under testing...'
override_attributes(
susemongodb: {
node_type: 'datanode',
node_nickname: 'jackey',
port: '27018',
is_replicaset_node: true,
is_cluster_node: true,
replicaset_name: 'myreplica',
clusterRole: 'configsvr',
}
)
run_list(
"recipe[susemongodb::setupmachine]",
"recipe[susemongodb::datanode]"
)
now, I would like to spin up multiple datanodes within the same VM,
so i have created another role similar to above but with different
attribute values.
name 'mongo_datanode_meerkat'
description 'this module is currently under testing...'
override_attributes(
susemongodb: {
node_type: 'datanode',
node_nickname: 'meerkat',
port: '27019',
is_replicaset_node: true,
is_cluster_node: true,
replicaset_name: 'myreplica',
clusterRole: 'configsvr',
}
)
run_list(
"recipe[susemongodb::setupmachine]",
"recipe[susemongodb::datanode]"
)
If you notice they are using the same recipe, which gets passed the attributes,
I am calling the roles in the client,
{
"name": "mongo1",
"chef_environment": "development",
"normal": {
"tags": [
]
},
"run_list": [
"role[mongo_datanode_jackey]",
"role[mongo_datanode_meerkat]",
"role[mongo_datanode_zebra]"
]
}
however, when chef runs the it runs on the last role on the run_list....any idea why?
[2016-02-11T16:51:35+00:00] INFO: Forking chef instance to converge...
[2016-02-11T16:51:35+00:00] INFO: *** Chef 12.6.0 ***
[2016-02-11T16:51:35+00:00] INFO: Chef-client pid: 14010
[2016-02-11T16:51:40+00:00] INFO: Run List is [role[mongo_datanode_jackey], role[mongo_datanode_meerkat], role[mongo_datanode_zebra]]
[2016-02-11T16:51:40+00:00] INFO: Run List expands to [susemongodb::setupmachine, susemongodb::datanode]
[2016-02-11T16:51:40+00:00] INFO: Starting Chef Run for mongo1
I would like each role to be applied on the server and use the common recipe.....?