Create nginx_proxy role

Used to configure hosts entries in the Gitea and Drone VMs, as well as
the allowed webhooks config for Gitea.
This commit is contained in:
2022-03-12 15:37:38 -06:00
parent b270a2c1fd
commit 0a953070fe
4 changed files with 54 additions and 7 deletions

View File

@@ -55,9 +55,24 @@ systemd_unit "drone.service" do
action [:create, :enable, :start]
end
nginx_proxy_ip_addresses = []
search(:node, "role:nginx_proxy").each do |node|
nginx_proxy_ip_addresses << node["knife_zero"]["host"]
end
nginx_proxy_ip_addresses.each do |ip_address|
IPAddr.new ip_address
hostsfile_entry ip_address do
hostname 'gitea.kosmos.org'
action :create
end
rescue IPAddr::InvalidAddressError
next
end
firewall_rule 'drone' do
port [node["kosmos_drone"]["upstream_port"]]
source "10.1.1.0/24"
source "10.1.1.0/24" # TODO only allow nginx proxy IPs
protocol :tcp
command :allow
end