Skip to content

Instantly share code, notes, and snippets.

@thommay
Last active January 9, 2017 04:21
Show Gist options
  • Save thommay/a8e620bb84c9acc648bc4cff691a23d6 to your computer and use it in GitHub Desktop.
Save thommay/a8e620bb84c9acc648bc4cff691a23d6 to your computer and use it in GitHub Desktop.
resource_name :email_alias
property :address
property :recipients, Array
default_action :create
action :create do
with_run_context :root do
edit_resource(:template, "/tmp/aliases") do |new_resource|
source 'aliases.erb'
variables[:aliases] ||= {}
variables[:aliases][new_resource.address] ||= []
variables[:aliases][new_resource.address] += new_resource.recipients
action :nothing
delayed_action :create
end
end
end
email_alias "thom" do
address "thom"
recipients %w{ foo bar baz }
end
email_alias "test" do
address "test"
recipients %w{ cat bodge baz }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment