Merge pull request 'Add hosts entries for ejabberd private IPs' (#257) from feature/akkounts_xmpp_host into master

Reviewed-on: #257
This commit is contained in:
Greg 2020-12-10 13:28:46 +00:00
commit f66f6e2969
1 changed files with 17 additions and 0 deletions

View File

@ -23,6 +23,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
require 'ipaddr'
app_name = "akkounts"
deploy_user = "deploy"
deploy_group = "deploy"
@ -143,4 +145,19 @@ application deploy_path do
end
end
ejabberd_private_ip_addresses = []
search(:node, "role:ejabberd").each do |node|
ejabberd_private_ip_addresses << node["knife_zero"]["host"]
end
ejabberd_private_ip_addresses.each do |ip_address|
IPAddr.new ip_address
hostsfile_entry ip_address do
hostname 'xmpp.kosmos.org'
action :create
end
rescue IPAddr::InvalidAddressError
next
end
include_recipe 'kosmos-akkounts::nginx'