LoginSignup
1
0

Chef レシピを YAML で記述する

Posted at

YAMLレシピ

Chefバージョン 16.0.257 以降のChefでRubyだけでなくYAMLでもレシピが書けるようになりました。(ReleaseNote リンク

---
resources:
  - type: "package"
    name: "httpd"
  - type: "template"
    name: "/var/www/html/index.html"
    source: "index.html.erb"
  - type: "service"
    name: "httpd"
    action:
      - enable
      - start

YAMLレシピをRubyレシピに変換

knife yaml convert [YAMLレシピファイル名] コマンドでYAMLレシピをRubyレシピに自動変換することができます。

上記のYAMLレシピは、以下のRubyコードに変換されます。

# Autoconverted recipe from yaml_recipe.yaml

package "httpd" do
end

template "/var/www/html/index.html" do
  source "index.html.erb"
end

service "httpd" do
  action ["enable", "start"]
end

ChefやInSpecのライセンス取得や技術サポート/コンサルに関しては、以下の国内代理店へお問い合わせください。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0