Skip to content

Instantly share code, notes, and snippets.

@hakopako
Last active June 8, 2016 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakopako/c381b891c5dab740970b262cbb4c675a to your computer and use it in GitHub Desktop.
Save hakopako/c381b891c5dab740970b262cbb4c675a to your computer and use it in GitHub Desktop.
itamae entrypoint.rb sample
node["recipes"] = node["recipes"] || []
host_name = node[:hostname] # SpecinfraというGemを利用しているらしい
host_group = host_name[/(.+)([0-9]){4}/, 1 ] # 号機を除いたホスト名 ex.) hogehoge0001 -> hogehoge
proxy_host = "bar"
proxy_port = "1234"
# 実行環境
if host_name.index("-dev") != nil then
env = "dev"
elsif host_name.index("-test") != nil then
env = "test"
else
env = "product"
end
node.reverse_merge!(
common: {
host_name: host_name ,
host_group: host_group ,
proxy_host: proxy_host,
proxy_port: proxy_port,
env: env
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment