end
group name.to_s do
- action :create
gid account["uid"].to_i
members group_members & node[:etc][:passwd].keys
end
user name.to_s do
- action :create
uid account["uid"].to_i
gid account["uid"].to_i
comment account["comment"] if account["comment"]
default_action :create
-property :name, String, :name_property => true
+property :source_name, String, :name_property => true
property :source_template, String, :default => "default.list.erb"
property :url, String, :required => true
property :key, String
execute "apt-key-#{key}-install" do
command "/usr/bin/apt-key adv --fetch-keys #{key_url}"
not_if "/usr/bin/apt-key adv --list-keys #{key}"
- notifies :run, "execute[apt-update-#{new_resource.name}]"
+ notifies :run, "execute[apt-update-#{source_name}]"
end
else
execute "apt-key-#{key}-install" do
command "/usr/bin/apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys #{key}"
not_if "/usr/bin/apt-key adv --list-keys #{key}"
- notifies :run, "execute[apt-update-#{new_resource.name}]"
+ notifies :run, "execute[apt-update-#{source_name}]"
end
end
end
group "root"
mode 0o644
variables :url => url
- notifies :run, "execute[apt-update-#{new_resource.name}]"
+ notifies :run, "execute[apt-update-#{source_name}]"
end
- execute "apt-update-#{name}" do
+ execute "apt-update-#{source_name}" do
action update ? :run : :nothing
command "/usr/bin/apt-get update --no-list-cleanup -o Dir::Etc::sourcelist='#{source_path}' -o Dir::Etc::sourceparts='-'"
end
end
def source_path
- "/etc/apt/sources.list.d/#{name}.list"
+ "/etc/apt/sources.list.d/#{source_name}.list"
end
default_action :create
-property :name, String
+property :site, String, :name_property => true
property :title, String, :required => true
property :aliases, [String, Array], :default => []
property :bbox, Array, :required => true
action :create do
- directory "/srv/#{name}" do
+ directory "/srv/#{site}" do
user "root"
group "root"
mode 0o755
end
- directory "/srv/imagery/layers/#{name}" do
+ directory "/srv/imagery/layers/#{site}" do
user "root"
group "root"
mode 0o755
recursive true
end
- directory "/srv/imagery/overlays/#{name}" do
+ directory "/srv/imagery/overlays/#{site}" do
user "root"
group "root"
mode 0o755
recursive true
end
- template "/srv/#{name}/index.html" do
+ template "/srv/#{site}/index.html" do
source "index.html.erb"
user "root"
group "root"
variables :title => title
end
- cookbook_file "/srv/#{name}/imagery.css" do
+ cookbook_file "/srv/#{site}/imagery.css" do
source "imagery.css"
user "root"
group "root"
mode 0o644
end
- cookbook_file "/srv/#{name}/clientaccesspolicy.xml" do
+ cookbook_file "/srv/#{site}/clientaccesspolicy.xml" do
source "clientaccesspolicy.xml"
user "root"
group "root"
mode 0o644
end
- cookbook_file "/srv/#{name}/crossdomain.xml" do
+ cookbook_file "/srv/#{site}/crossdomain.xml" do
source "crossdomain.xml"
user "root"
group "root"
mode 0o644
end
- layers = Dir.glob("/srv/imagery/layers/#{name}/*.yml").collect do |path|
+ layers = Dir.glob("/srv/imagery/layers/#{site}/*.yml").collect do |path|
YAML.safe_load(::File.read(path), [Symbol])
end
- template "/srv/#{name}/imagery.js" do
+ template "/srv/#{site}/imagery.js" do
source "imagery.js.erb"
user "root"
group "root"
variables :bbox => bbox, :layers => layers
end
- base_domains = [name] + Array(aliases)
+ base_domains = [site] + Array(aliases)
tile_domains = base_domains.flat_map { |d| [d, "a.#{d}", "b.#{d}", "c.#{d}"] }
- ssl_certificate new_resource.name do
+ ssl_certificate site do
domains tile_domains
end
IPAddr.new(resolver).ipv6? ? "[#{resolver}]" : resolver
end
- nginx_site new_resource.name do
+ nginx_site site do
template "nginx_imagery.conf.erb"
- directory "/srv/imagery/#{name}"
+ directory "/srv/imagery/#{site}"
restart_nginx false
variables new_resource.to_hash.merge(:resolvers => resolvers)
end
extension_script = "#{extension_directory}/#{new_resource.name}.php"
file "#{mediawiki_directory}/LocalSettings.d/Ext-#{new_resource.name}.inc.php" do
- action :create
content "<?php wfLoadExtension( '#{new_resource.name}' );\n"
user node[:mediawiki][:user]
group node[:mediawiki][:group]
not_if do
::File.exist?("#{mediawiki_directory}/LocalSettings-install.php")
end
- notifies :create, "ruby_block[rename-installer-localsettings]", :immediately
+ notifies :run, "ruby_block[rename-installer-localsettings]", :immediately
end
execute "#{mediawiki_directory}/maintenance/update.php" do
# Safety catch if git doesn't update but install.php hasn't run
ruby_block "catch-installer-localsettings-run" do
- action :create
+ action :run
block do
#
end
skin_script = "#{skin_directory}/#{new_resource.name}.php"
file "#{mediawiki_directory}/LocalSettings.d/Skin-#{new_resource.name}.inc.php" do
- action :create
content "<?php require_once('#{skin_script}');\n"
user node[:mediawiki][:user]
group node[:mediawiki][:group]
default_action :create
-property :name, String
+property :certificate, String, :name_property => true
property :domains, [String, Array], :required => true
action :create do
- node.default[:letsencrypt][:certificates][name] = {
+ node.default[:letsencrypt][:certificates][certificate] = {
:domains => Array(domains)
}
if letsencrypt
- certificate = letsencrypt["certificate"]
- key = letsencrypt["key"]
+ certificate_content = letsencrypt["certificate"]
+ key_content = letsencrypt["key"]
end
- if certificate
- file "/etc/ssl/certs/#{name}.pem" do
+ if certificate_content
+ file "/etc/ssl/certs/#{certificate}.pem" do
owner "root"
group "root"
mode 0o444
- content certificate
+ content certificate_content
backup false
manage_symlink_source false
force_unlink true
end
- file "/etc/ssl/private/#{name}.key" do
+ file "/etc/ssl/private/#{certificate}.key" do
owner "root"
group "ssl-cert"
mode 0o440
- content key
+ content key_content
backup false
manage_symlink_source false
force_unlink true
end
else
- template "/tmp/#{name}.ssl.cnf" do
+ template "/tmp/#{certificate}.ssl.cnf" do
cookbook "ssl"
source "ssl.cnf.erb"
owner "root"
group "root"
mode 0o644
- variables :domains => Array(new_resource.domains)
+ variables :domains => Array(domains)
not_if do
- ::File.exist?("/etc/ssl/certs/#{new_resource.name}.pem") && ::File.exist?("/etc/ssl/private/#{new_resource.name}.key")
+ ::File.exist?("/etc/ssl/certs/#{certificate}.pem") && ::File.exist?("/etc/ssl/private/#{certificate}.key")
end
end
- execute "/etc/ssl/certs/#{name}.pem" do
- command "openssl req -x509 -newkey rsa:2048 -keyout /etc/ssl/private/#{new_resource.name}.key -out /etc/ssl/certs/#{new_resource.name}.pem -days 365 -nodes -config /tmp/#{new_resource.name}.ssl.cnf"
+ execute "/etc/ssl/certs/#{certificate}.pem" do
+ command "openssl req -x509 -newkey rsa:2048 -keyout /etc/ssl/private/#{certificate}.key -out /etc/ssl/certs/#{certificate}.pem -days 365 -nodes -config /tmp/#{certificate}.ssl.cnf"
user "root"
group "ssl-cert"
not_if do
- ::File.exist?("/etc/ssl/certs/#{new_resource.name}.pem") && ::File.exist?("/etc/ssl/private/#{new_resource.name}.key")
+ ::File.exist?("/etc/ssl/certs/#{certificate}.pem") && ::File.exist?("/etc/ssl/private/#{certificate}.key")
end
end
end
end
action :delete do
- file "/etc/ssl/certs/#{name}.pem" do
+ file "/etc/ssl/certs/#{certificate}.pem" do
action :delete
end
- file "/etc/ssl/private/#{name}.key" do
+ file "/etc/ssl/private/#{certificate}.key" do
action :delete
end
end
def letsencrypt
- @letsencrypt ||= search(:letsencrypt, "id:#{name}").first
+ @letsencrypt ||= search(:letsencrypt, "id:#{certificate}").first
end
default_action :create
-property :name, String
+property :path, String, :name_property => true
property :description, String, :required => true
property :after, [String, Array]
property :wants, [String, Array]
action :create do
path_variables = new_resource.to_hash
- template "/etc/systemd/system/#{name}.path" do
+ template "/etc/systemd/system/#{path}.path" do
cookbook "systemd"
source "path.erb"
owner "root"
variables path_variables
end
- execute "systemctl-reload-#{name}.path" do
+ execute "systemctl-reload-#{path}.path" do
action :nothing
command "systemctl daemon-reload"
user "root"
group "root"
- subscribes :run, "template[/etc/systemd/system/#{name}.path]"
+ subscribes :run, "template[/etc/systemd/system/#{path}.path]"
end
end
action :delete do
- file "/etc/systemd/system/#{name}.path" do
+ file "/etc/systemd/system/#{path}.path" do
action :delete
end
- execute "systemctl-reload-#{name}.path" do
+ execute "systemctl-reload-#{path}.path" do
action :nothing
command "systemctl daemon-reload"
user "root"
group "root"
- subscribes :run, "file[/etc/systemd/system/#{name}.path]"
+ subscribes :run, "file[/etc/systemd/system/#{path}.path]"
end
end
default_action :create
-property :name, String
+property :service, String, :name_property => true
property :description, String, :required => true
property :after, [String, Array]
property :wants, [String, Array]
service_variables = new_resource.to_hash
if environment_file.is_a?(Hash)
- template "/etc/default/#{name}" do
+ template "/etc/default/#{service}" do
cookbook "systemd"
source "environment.erb"
owner "root"
variables :environment => environment_file
end
- service_variables[:environment_file] = "/etc/default/#{name}"
+ service_variables[:environment_file] = "/etc/default/#{service}"
end
- template "/etc/systemd/system/#{name}.service" do
+ template "/etc/systemd/system/#{service}.service" do
cookbook "systemd"
source "service.erb"
owner "root"
variables service_variables
end
- execute "systemctl-reload-#{name}.service" do
+ execute "systemctl-reload-#{service}.service" do
action :nothing
command "systemctl daemon-reload"
user "root"
group "root"
- subscribes :run, "template[/etc/systemd/system/#{name}.service]"
+ subscribes :run, "template[/etc/systemd/system/#{service}.service]"
end
end
action :delete do
- file "/etc/default/#{name}" do
+ file "/etc/default/#{service}" do
action :delete
only_if { environment_file.is_a?(Hash) }
end
- file "/etc/systemd/system/#{name}.service" do
+ file "/etc/systemd/system/#{service}.service" do
action :delete
end
- execute "systemctl-reload-#{name}.service" do
+ execute "systemctl-reload-#{service}.service" do
action :nothing
command "systemctl daemon-reload"
user "root"
group "root"
- subscribes :run, "file[/etc/systemd/system/#{name}.service]"
+ subscribes :run, "file[/etc/systemd/system/#{service}.service]"
end
end
owner "taginfo"
group "taginfo"
mode "0755"
- action :create
end
execute "compile-osmium" do
# resources related to the output of the analysis and where it
# can be publicly downloaded.
directory tilelog_output_directory do
- action :create
user "www-data"
group "www-data"
mode 0o755