3 Commits

3 changed files with 55 additions and 5 deletions

View File

@@ -3,6 +3,9 @@
"normal": { "normal": {
"knife_zero": { "knife_zero": {
"host": "10.147.20.166" "host": "10.147.20.166"
},
"kosmos-ejabberd": {
"erlang_node": "ejabberd@draco.kosmos.org"
} }
}, },
"automatic": { "automatic": {

View File

@@ -3,6 +3,9 @@
"normal": { "normal": {
"knife_zero": { "knife_zero": {
"host": "10.147.20.44" "host": "10.147.20.44"
},
"kosmos-ejabberd": {
"erlang_node": "ejabberd@centaurus.kosmos.org"
} }
}, },
"automatic": { "automatic": {
@@ -12,11 +15,16 @@
"hostname": "ejabberd-2", "hostname": "ejabberd-2",
"ipaddress": "192.168.122.5", "ipaddress": "192.168.122.5",
"roles": [ "roles": [
"ejabberd",
"postgresql_client"
], ],
"recipes": [ "recipes": [
"kosmos-base", "kosmos-base",
"kosmos-base::default", "kosmos-base::default",
"kosmos-ejabberd",
"kosmos-ejabberd::default",
"kosmos-ejabberd::letsencrypt",
"kosmos-ejabberd::backup",
"apt::default", "apt::default",
"timezone_iii::default", "timezone_iii::default",
"timezone_iii::debian", "timezone_iii::debian",
@@ -30,7 +38,11 @@
"postfix::_common", "postfix::_common",
"postfix::_attributes", "postfix::_attributes",
"postfix::sasl_auth", "postfix::sasl_auth",
"hostname::default" "hostname::default",
"tor-full::default",
"kosmos-base::letsencrypt",
"backup::default",
"logrotate::default"
], ],
"platform": "ubuntu", "platform": "ubuntu",
"platform_version": "20.04", "platform_version": "20.04",
@@ -47,6 +59,7 @@
} }
}, },
"run_list": [ "run_list": [
"recipe[kosmos-base]" "recipe[kosmos-base]",
"role[ejabberd]"
] ]
} }

View File

@@ -50,6 +50,28 @@ file "/opt/ejabberd/.erlang.cookie" do
content ejabberd_credentials['erlang_cookie'] content ejabberd_credentials['erlang_cookie']
end end
file "/opt/ejabberd/.hosts.erlang" do
mode "0644"
owner "ejabberd"
group "ejabberd"
content <<-EOF
"andromeda.kosmos.org".
"centaurus.kosmos.org".
"draco.kosmos.org".
EOF
end
ruby_block "configure ERLANG_NODE" do
block do
file = Chef::Util::FileEdit.new("/opt/ejabberd/conf/ejabberdctl.cfg")
file.search_file_replace_line(
%r{#ERLANG_NODE=ejabberd@localhost},
"ERLAND_NODE=#{node['kosmos-ejabberd']['erlang_node']}"
)
file.write_file
end
end
postgresql_data_bag_item = data_bag_item('credentials', 'postgresql') postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
hosts = [ hosts = [
@@ -203,6 +225,18 @@ unless node.chef_environment == "development"
command :allow command :allow
end end
firewall_rule 'ejabberd_cluster' do
port [4369]
protocol :tcp
command :allow
end
firewall_rule 'erlang_cluster' do
port [4200..4210]
protocol :tcp
command :allow
end
firewall_rule 'ejabberd_stun_turn' do firewall_rule 'ejabberd_stun_turn' do
port 3478 port 3478
protocol :tcp protocol :tcp