How to run the itamae recipe on multiple nodes

Asked 1 years ago, Updated 1 years ago, 106 views

I looked it up, but there was an article that linked with capistorano, but there was no article that I would do alone

If itamae itself doesn't have a function
If you give the number by parameter, make the number of hosts consecutively
I'd like to make a recipe to apply it

So is there a way to give parameters on the itamae command line?

for in 1..node [n_api_servers]
  execute 'bundle execitamaessh-hapi#{i}.local roles/api/default.rb-y nodes/api.#{env}.yml'
end

In the image, I would like to write and execute this recipe.
I'd like to pass the parameter of the consecutive hostname api#{i} to the value that can be retrieved in the recipe (for example, node['host_name']).
I think I can do it, but I couldn't find an article...

If you can't, write down the number of host_name changes in the nodes/ configuration file.

for in 1..node [n_api_servers]
  execute 'bundle execitamesh-hapi#{i}.local roles/api/default.rb-y nodes/api#{i}.#{env}.yml'
end

I guess I have no choice but to call it…

Or I would appreciate it if you could let me know if there is a better way to apply the same recipe to multiple units.

Note:

I tried kondate, but

I think I need to prepare the number of settings for hosts.yml.
If you have enough settings, you can do it, but it's not pretty. Would it be possible to write corresponding to the variable number?

in hosts.yml
 api1: [api]
api2—[api]
  :

Instead of doing this, like ssh/config

 api*: [api]

Would you be able to do something like that?

itamae

2022-09-30 21:43

1 Answers

https://github.com/sonots/kondate

There is a Gem called ^kondate, which is a tool for running itamae like Ansible

If you want to provision multiple servers the same way, I think this can be done by defining the recipe for the role and assigning multiple hosts to it.

When running multiple hosts in parallel, README says bundle exec kondate itamae-role is exactly what the questioner wants now.

(In addition)

)

https://github.com/sonots/kondate#host-plugin

^ Using the host plugin above, I think I can write the logic of linking the host name to the role myself.

I've never used this feature myself, so I don't know if I can do it well, but as far as I read the document, I think I can define any host->role association.


2022-09-30 21:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.