å·çæã® chef ã®ãã¼ã¸ã§ã³ã¯ä»¥ä¸ã®ã¨ããã§ãã $ rpm -q chef chef-11.16.4-1.el6.x86_64chef ã§ãã¡ã¤ã«ã®å¤æ´ãããå ´åã chef/file_edit.rb at 11.16.4 · opscode/chef · GitHub ã使ããã¨ã§ç°¡åã«è¡ããã¨ãã§ãã¾ãã å®éã«ã³ã¼ããæ¸ãå ´åã¯ã file "/tmp/testfile" do f = Chef::Util::FileEdit.new(path) f.insert_line_if_no_match(/hogehoge/, "hogehoge") f.write_file end ã®ããã«è¨è¿°ãããã¨ã§ãã¡ã¤ã«ãå¤æ´ãããã¨ãã§ãã¾ãã åã¡ã½ãããç°¡åã«èª¬æããã¨ã insert_line_if_no_match ã¯ã第ä¸å¼æ°ã® regex ã« match ããªããã°ç¬¬äºå¼æ°ã®
{{#tags}}- {{label}}
{{/tags}}