]> git.openstreetmap.org Git - chef.git/commitdiff
Reduce implicit coupling between cookbooks
authorTom Hughes <tom@compton.nu>
Sat, 15 Feb 2020 16:56:35 +0000 (16:56 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 15 Feb 2020 17:32:12 +0000 (17:32 +0000)
23 files changed:
.kitchen.yml
cookbooks/blogs/metadata.rb
cookbooks/blogs/recipes/default.rb
cookbooks/donate/attributes/default.rb [new file with mode: 0644]
cookbooks/donate/metadata.rb
cookbooks/donate/recipes/default.rb
cookbooks/forum/attributes/default.rb [new file with mode: 0644]
cookbooks/forum/metadata.rb
cookbooks/forum/recipes/default.rb
cookbooks/letsencrypt/attributes/default.rb [new file with mode: 0644]
cookbooks/letsencrypt/metadata.rb
cookbooks/letsencrypt/recipes/default.rb
cookbooks/ohai/resources/plugin.rb
cookbooks/otrs/attributes/default.rb
cookbooks/otrs/metadata.rb
cookbooks/otrs/recipes/default.rb
cookbooks/postgresql/recipes/default.rb
cookbooks/squid/metadata.rb
cookbooks/squid/recipes/default.rb
roles/donate.rb
roles/forum.rb
roles/letsencrypt.rb
roles/otrs.rb

index 63e3503e2125577d920518e04158aa7a709c6691..9b9a4c03cd85516739f255aed256a66fbbe4eba8 100644 (file)
@@ -40,7 +40,6 @@ suites:
         clients: none
   - name: blogs
     run_list:
         clients: none
   - name: blogs
     run_list:
-      - recipe[accounts::default]
       - recipe[blogs::default]
   - name: clamav
     run_list:
       - recipe[blogs::default]
   - name: clamav
     run_list:
@@ -74,8 +73,7 @@ suites:
         mpm: prefork
   - name: donate
     run_list:
         mpm: prefork
   - name: donate
     run_list:
-      - recipe[accounts::default]
-      - role[donate]
+      - recipe[donate::default]
     attributes:
       apache:
         mpm: prefork
     attributes:
       apache:
         mpm: prefork
@@ -87,15 +85,15 @@ suites:
       - recipe[fail2ban::default]
   - name: forum
     run_list:
       - recipe[fail2ban::default]
   - name: forum
     run_list:
-      - recipe[accounts::default]
-      - role[forum]
+      - recipe[forum::default]
+    attributes:
+      apache:
+        mpm: prefork
   - name: incron
     run_list:
       - recipe[incron::default]
   - name: letsencrypt
     run_list:
   - name: incron
     run_list:
       - recipe[incron::default]
   - name: letsencrypt
     run_list:
-      - recipe[accounts::default]
-      - recipe[apt::default]
       - role[letsencrypt]
     attributes:
       apt:
       - role[letsencrypt]
     attributes:
       apt:
@@ -139,9 +137,7 @@ suites:
       - recipe[osmosis::default]
   - name: otrs
     run_list:
       - recipe[osmosis::default]
   - name: otrs
     run_list:
-      - recipe[accounts::default]
-      - recipe[chef::default]
-      - role[otrs]
+      - recipe[otrs::default]
   - name: planet
     run_list:
       - recipe[planet::default]
   - name: planet
     run_list:
       - recipe[planet::default]
@@ -168,7 +164,6 @@ suites:
       - recipe[spamassassin::default]
   - name: squid
     run_list:
       - recipe[spamassassin::default]
   - name: squid
     run_list:
-      - recipe[apt::default]
       - recipe[squid::default]
   - name: tools
     run_list:
       - recipe[squid::default]
   - name: tools
     run_list:
index 6f2b7dfc6dc5aa667340907cc79daa1b24d9674d..19d88bcfec8c8f80a8ed933c2e449b70d9ba62df 100644 (file)
@@ -6,5 +6,6 @@ description       "Configures server-info web site"
 
 version           "1.0.0"
 supports          "ubuntu"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "git"
 depends           "apache"
 depends           "git"
index c8c96788c8231ab1c827422fdd299d62e38075df..6432a98d331ae3554593f4402f8256820981a4dc 100644 (file)
@@ -17,6 +17,7 @@
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
+include_recipe "accounts"
 include_recipe "apache"
 include_recipe "git"
 
 include_recipe "apache"
 include_recipe "git"
 
diff --git a/cookbooks/donate/attributes/default.rb b/cookbooks/donate/attributes/default.rb
new file mode 100644 (file)
index 0000000..8ce74ce
--- /dev/null
@@ -0,0 +1 @@
+default[:accounts][:users][:donate][:status] = :role
index 0882bddf8cc9522c60ae639218b558ca0598f181..645e74851203b115c91c22b0572d6cdd9172e050 100644 (file)
@@ -6,6 +6,7 @@ description       "Installs and configures Donate Site"
 
 version           "1.0.0"
 supports          "ubuntu"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "mysql"
 depends           "git"
 depends           "apache"
 depends           "mysql"
 depends           "git"
index 1b3ede31092dcdd6857a5c5f45124c496561cb76..25441aaf62cf7d6a6e609b97a2922c5fe08381a9 100644 (file)
@@ -17,6 +17,7 @@
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
+include_recipe "accounts"
 include_recipe "apache"
 include_recipe "mysql"
 include_recipe "git"
 include_recipe "apache"
 include_recipe "mysql"
 include_recipe "git"
diff --git a/cookbooks/forum/attributes/default.rb b/cookbooks/forum/attributes/default.rb
new file mode 100644 (file)
index 0000000..0c376d5
--- /dev/null
@@ -0,0 +1 @@
+default[:accounts][:users][:forum][:status] = :role
index 21edbfe64551245457bc39d4a282a1c5cb4d8a6f..edf2fac4812ef16f9c21ff2706aa9d9072cf7c04 100644 (file)
@@ -6,6 +6,7 @@ description       "Installs and configures a roundup server"
 
 version           "1.0.0"
 supports          "ubuntu"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "git"
 depends           "mysql"
 depends           "apache"
 depends           "git"
 depends           "mysql"
index fcbf2f3305485014e688619c3d3c66c71456daf7..1e5a4216fb80ee6b6329b3667f811f71b6a1037e 100644 (file)
@@ -16,6 +16,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+
+include_recipe "accounts"
 include_recipe "apache"
 include_recipe "git"
 include_recipe "mysql"
 include_recipe "apache"
 include_recipe "git"
 include_recipe "mysql"
diff --git a/cookbooks/letsencrypt/attributes/default.rb b/cookbooks/letsencrypt/attributes/default.rb
new file mode 100644 (file)
index 0000000..21b32a8
--- /dev/null
@@ -0,0 +1 @@
+default[:accounts][:users][:letsencrypt][:status] = :role
index 3af7bdd2e99fc3815a355dbe31cd1367afb885a2..50f1874b2d5a973d14f466186325a2d5d34cda8c 100644 (file)
@@ -6,4 +6,5 @@ description       "Support for letsencrypt certificates"
 
 version           "1.0.0"
 supports          "ubuntu"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "apache"
index 05b1c0fa8d5d0f561a4d71296ec07741d8db57ed..a1df6819035b160a35a42580998811cdb8d3da6c 100644 (file)
@@ -17,6 +17,7 @@
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
+include_recipe "accounts"
 include_recipe "apache"
 
 keys = data_bag_item("chef", "keys")
 include_recipe "apache"
 
 keys = data_bag_item("chef", "keys")
@@ -147,6 +148,7 @@ certificates.each do |name, details|
     user "letsencrypt"
     group "letsencrypt"
     subscribes :run, "template[/srv/acme.openstreetmap.org/requests/#{name}]"
     user "letsencrypt"
     group "letsencrypt"
     subscribes :run, "template[/srv/acme.openstreetmap.org/requests/#{name}]"
+    not_if { ENV["TEST_KITCHEN"] }
   end
 end
 
   end
 end
 
index 9367a4d831cfaacd61a4052736627bdb6c0f7a9c..ceff104b91dad3cb0d7d05902ca49a6299f8e9d5 100644 (file)
@@ -27,6 +27,13 @@ action :create do
     action :nothing
   end
 
     action :nothing
   end
 
+  directory "/etc/chef/ohai" do
+    owner "root"
+    group "root"
+    mode 0o755
+    recursive true
+  end
+
   declare_resource :template, plugin_path do
     source new_resource.template
     owner "root"
   declare_resource :template, plugin_path do
     source new_resource.template
     owner "root"
index fff2dc008a371c2eb49bc2c1226dc84e30cea493..7f3d32be73056e6e904665df2898d6ffbe0ac4cb 100644 (file)
@@ -1,8 +1,13 @@
 default[:otrs][:version] = "6.0.8"
 default[:otrs][:user] = "otrs"
 default[:otrs][:group] = nil
 default[:otrs][:version] = "6.0.8"
 default[:otrs][:user] = "otrs"
 default[:otrs][:group] = nil
-default[:otrs][:database_cluster] = "9.5/main"
+default[:otrs][:database_cluster] = "10/main"
 default[:otrs][:database_name] = "otrs"
 default[:otrs][:database_user] = "otrs"
 default[:otrs][:database_name] = "otrs"
 default[:otrs][:database_user] = "otrs"
-default[:otrs][:database_password] = ""
-default[:otrs][:site] = nil
+default[:otrs][:database_password] = "otrs"
+default[:otrs][:site] = "otrs"
+
+default[:postgresql][:versions] |= ["10"]
+
+default[:accounts][:users][:otrs][:status] = :role
+default[:accounts][:groups][:"www-data"][:members] = [:otrs]
index 39f6087c34da50c83d5fd87d2839c10d5c9b00a9..1cdd780207b2f34564f91b53a68aa41f8f21008e 100644 (file)
@@ -6,6 +6,8 @@ description       "Installs and configures OTRS"
 
 version           "1.0.0"
 supports          "ubuntu"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "apache"
+depends           "chef"
 depends           "postgresql"
 depends           "tools"
 depends           "postgresql"
 depends           "tools"
index 260623a80e332c211ca0dc9fcc4abd72b9ffe869..e43a89244398a6bf51bbc5a2960574005e93b62e 100644 (file)
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
-include_recipe "tools"
-include_recipe "postgresql"
+include_recipe "accounts"
 include_recipe "apache"
 include_recipe "apache"
+include_recipe "postgresql"
+include_recipe "tools"
 
 passwords = data_bag_item("otrs", "passwords")
 
 
 passwords = data_bag_item("otrs", "passwords")
 
index 3a3c63de108fc2413aac45d60843255ace3a3fc8..a79cde84d4157985dd80350907e9390fde06636b 100644 (file)
@@ -17,6 +17,7 @@
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
+package "locales-all"
 package "postgresql-common"
 
 node[:postgresql][:versions].each do |version|
 package "postgresql-common"
 
 node[:postgresql][:versions].each do |version|
index 845f7bd0c30730a14d0695bd6fc858ef533046bb..2e0c9a4ab36eeaaf924174897e9c6a19a78de33c 100644 (file)
@@ -6,5 +6,6 @@ description       "Installs and configures squid"
 
 version           "1.0.0"
 supports          "ubuntu"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "apt"
 depends           "munin"
 depends           "systemd"
 depends           "munin"
 depends           "systemd"
index fcc5f337c6c07cce8816abab687a599ecab4837d..a5af78090ea766595b5b53dc106d9abcd24da714 100644 (file)
@@ -17,6 +17,8 @@
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
+include_recipe "apt"
+
 if node[:squid][:version] >= 3
   apt_package "squid" do
     action :unlock
 if node[:squid][:version] >= 3
   apt_package "squid" do
     action :unlock
index 6e5f2c614ebe601ea15765a46002082038707a90..a40547878e7d8dde9d6968542a4ae1d65ded3543 100644 (file)
@@ -1,17 +1,6 @@
 name "donate"
 description "Role applied to all donate servers"
 
 name "donate"
 description "Role applied to all donate servers"
 
-default_attributes(
-  :accounts => {
-    :users => {
-      :donate => {
-        :status => :role,
-        :members => [:grant, :tomh, :matt]
-      }
-    }
-  }
-)
-
 run_list(
   "recipe[donate]"
 )
 run_list(
   "recipe[donate]"
 )
index e9a38146ab28be895cff281fd2d179e8c3a442e8..8273fc47f20f27c1d4b877fa8ebd3b7f78ccdc0c 100644 (file)
@@ -2,17 +2,6 @@ name "forum"
 description "Role applied to all forum servers"
 
 default_attributes(
 description "Role applied to all forum servers"
 
 default_attributes(
-  :accounts => {
-    :users => {
-      :lambertus => {
-        :status => :administrator
-      },
-      :forum => {
-        :status => :role,
-        :members => [:lambertus, :grant]
-      }
-    }
-  },
   :apache => {
     :mpm => "prefork",
     :timeout => 60,
   :apache => {
     :mpm => "prefork",
     :timeout => 60,
index c0b389da90aa2a3eba8b2a4e7b5815f967d6ceb8..3c96b90ae18a589b72119b0476c2b1e3565e2e71 100644 (file)
@@ -1,16 +1,6 @@
 name "letsencrypt"
 description "Role applied to all letsencrypt servers"
 
 name "letsencrypt"
 description "Role applied to all letsencrypt servers"
 
-default_attributes(
-  :accounts => {
-    :users => {
-      :letsencrypt => {
-        :status => :role
-      }
-    }
-  }
-)
-
 run_list(
   "recipe[letsencrypt]"
 )
 run_list(
   "recipe[letsencrypt]"
 )
index 09ec3453eaa6a8221b2b03962201b9010e943797..ec1264eb3249f33133378262a7d4447a920d455b 100644 (file)
@@ -2,16 +2,6 @@ name "otrs"
 description "Role applied to all OTRS servers"
 
 default_attributes(
 description "Role applied to all OTRS servers"
 
 default_attributes(
-  :accounts => {
-    :users => {
-      :otrs => { :status => :role }
-    },
-    :groups => {
-      :"www-data" => {
-        :members => [:otrs]
-      }
-    }
-  },
   :exim => {
     :local_domains => ["otrs.openstreetmap.org"],
     :routes => {
   :exim => {
     :local_domains => ["otrs.openstreetmap.org"],
     :routes => {
@@ -100,14 +90,7 @@ default_attributes(
   },
   :otrs => {
     :site => "otrs.openstreetmap.org",
   },
   :otrs => {
     :site => "otrs.openstreetmap.org",
-    :site_aliases => ["otrs.osm.org"],
-    :database_cluster => "10/main",
-    :database_name => "otrs",
-    :database_user => "otrs",
-    :database_password => "otrs"
-  },
-  :postgresql => {
-    :versions => ["10"]
+    :site_aliases => ["otrs.osm.org"]
   }
 )
 
   }
 )