Skip to content

Commit de7022c

Browse files
committed
Add aws-boxcutter-nexus
1 parent 696e473 commit de7022c

File tree

2 files changed

+92
-69
lines changed

2 files changed

+92
-69
lines changed

cookbooks/boxcutter_backhaul/kitchen.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ provisioner:
2424
transport:
2525
name: dokken
2626

27+
lifecycle:
28+
post_create:
29+
- remote: |
30+
bash -c -x '
31+
# Force firstboot
32+
touch /root/firstboot_os
33+
'
34+
2735
verifier:
2836
name: inspec
2937

cookbooks/boxcutter_backhaul/recipes/default.rb

Lines changed: 84 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,60 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19-
nfs_server_hosts = %w{
20-
nfs-server-centos-stream-9
21-
nfs-server-ubuntu-2204
22-
}.include?(node['hostname'])
23-
24-
if nfs_server_hosts
25-
node.default['fb_iptables']['filter']['INPUT']['rules']['nfs server'] = {
26-
'rules' => [
27-
'-p tcp --dport 2049 -j ACCEPT',
28-
'-p udp --dport 2049 -j ACCEPT',
29-
],
30-
}
31-
32-
directory '/var/nfs' do
33-
owner node.root_user
34-
group node.root_group
35-
mode '0755'
36-
end
37-
38-
directory '/var/nfs/general' do
39-
owner 'nobody'
40-
group node.ubuntu? ? 'nogroup' : 'nobody'
41-
mode '0777'
42-
end
43-
44-
node.default['boxcutter_nfs']['server']['exports']['/var/nfs/general'] = %w{
45-
*(rw,sync,no_subtree_check,insecure)
46-
}
47-
48-
include_recipe 'boxcutter_nfs::server'
49-
end
19+
# nfs_server_hosts = %w{
20+
# nfs-server-centos-stream-9
21+
# nfs-server-ubuntu-2204
22+
# }.include?(node['hostname'])
23+
#
24+
# if nfs_server_hosts
25+
# node.default['fb_iptables']['filter']['INPUT']['rules']['nfs server'] = {
26+
# 'rules' => [
27+
# '-p tcp --dport 2049 -j ACCEPT',
28+
# '-p udp --dport 2049 -j ACCEPT',
29+
# ],
30+
# }
31+
#
32+
# directory '/var/nfs' do
33+
# owner node.root_user
34+
# group node.root_group
35+
# mode '0755'
36+
# end
37+
#
38+
# directory '/var/nfs/general' do
39+
# owner 'nobody'
40+
# group node.ubuntu? ? 'nogroup' : 'nobody'
41+
# mode '0777'
42+
# end
43+
#
44+
# node.default['boxcutter_nfs']['server']['exports']['/var/nfs/general'] = %w{
45+
# *(rw,sync,no_subtree_check,insecure)
46+
# }
47+
#
48+
# include_recipe 'boxcutter_nfs::server'
49+
# end
5050

5151
nexus_hosts = %w{
52-
crake-nexus
52+
ip-10-0-1-51
5353
}.include?(node['hostname'])
5454

5555
if nexus_hosts
56+
# op item get 'tailscale oauth automation-sandbox-write-blue' --vault Automation-Sandbox
57+
# op item get v5zvz2gomyzhgow46esj7txneu --format json
58+
tailscale_oauth_client_id_write_blue =\
59+
Boxcutter::OnePassword.op_read('op://Automation-Org/tailscale oauth write blue/username')
60+
tailscale_oauth_client_secret_write_blue = \
61+
Boxcutter::OnePassword.op_read('op://Automation-Org/tailscale oauth write blue/credential')
62+
node.run_state['boxcutter_tailscale'] ||= {}
63+
node.run_state['boxcutter_tailscale']['oauth_client_id'] = tailscale_oauth_client_id_write_blue
64+
node.run_state['boxcutter_tailscale']['oauth_client_secret'] = tailscale_oauth_client_secret_write_blue
65+
node.default['boxcutter_tailscale']['enable'] = true
66+
node.default['boxcutter_tailscale']['ephemeral'] = false
67+
node.default['boxcutter_tailscale']['use_tailscale_dns'] = false
68+
node.default['boxcutter_tailscale']['shields_up'] = false
69+
node.default['boxcutter_tailscale']['hostname'] = 'aws-boxcutter-nexus'
70+
node.default['boxcutter_tailscale']['tags'] = ['chef']
71+
include_recipe 'boxcutter_tailscale::default'
72+
5673
node.default['boxcutter_sonatype']['nexus_repository']['repositories'] = {
5774
'ros-apt-proxy' => {
5875
'name' => 'ros-apt-proxy',
@@ -184,15 +201,15 @@
184201
},
185202
}
186203

187-
cloudflare_api_token = Boxcutter::OnePassword.op_read(
188-
'op://Automation-Org/Cloudflare API token amazing-sheila/credential',
189-
)
204+
# cloudflare_api_token = Boxcutter::OnePassword.op_read(
205+
# 'op://Automation-Org/Cloudflare API token amazing-sheila/credential',
206+
# )
190207

191208
# Set up an HTTP-only listener for ubuntu proxies because apt doesn't work
192209
# well with HTTPS
193210
node.default['fb_nginx']['sites']['nexus_http'] = {
194211
'listen' => '80',
195-
'server_name' => 'crake-nexus.org.boxcutter.net',
212+
'server_name' => 'aws-boxcutter-nexus.org.boxcutter.net',
196213
'location ~ ^/repository/' \
197214
'(ros-apt-proxy|' \
198215
'ubuntu-archive-apt-proxy|' \
@@ -210,30 +227,28 @@
210227
},
211228
}
212229

213-
node.default['boxcutter_acme']['lego']['config'] = {
230+
node.run_state['boxcutter_acme'] ||= {}
231+
node.run_state['boxcutter_acme']['certbot'] ||= {}
232+
node.run_state['boxcutter_acme']['certbot']['cloudflare_api_token'] = \
233+
Boxcutter::OnePassword.op_read('op://Automation-Org/Cloudflare API token amazing-sheila/credential')
234+
235+
node.default['boxcutter_acme']['certbot']['config'] = {
214236
'nexus' => {
215-
'certificate_name' => 'crake-nexus.org.boxcutter.net',
216-
'data_path' => '/etc/lego',
217-
'renew_script_path' => '/opt/lego/lego_renew.sh',
218-
'renew_days' => '30',
237+
'renew_script_path' => '/opt/certbot/bin/certbot_renew.sh',
238+
'certbot_bin' => '/opt/certbot/venv/bin/certbot',
239+
'domains' => ['aws-boxcutter-nexus.org.boxcutter.net', '*.aws-boxcutter-nexus.org.boxcutter.net'],
219240
'email' => 'letsencrypt@boxcutter.dev',
220-
'domains' => %w{
221-
crake-nexus.org.boxcutter.net
222-
*.crake-nexus.org.boxcutter.net
223-
},
224-
'extra_parameters' => [
225-
'--dns=cloudflare',
226-
# There are issues resolving apex domain servers over tailscale, so
227-
# override the DNS resolver lego uses, in case we're running tailscale
228-
'--dns.resolvers=newt.ns.cloudflare.com:53',
229-
],
230-
'extra_environment' => {
231-
'export CF_DNS_API_TOKEN' => cloudflare_api_token,
232-
},
241+
'cloudflare_ini' => '/etc/chef/cloudflare.ini',
242+
'extra_args' => [
243+
'--dns-cloudflare',
244+
'--dns-cloudflare-credentials /etc/chef/cloudflare.ini',
245+
'--test-cert',
246+
].join(' '),
233247
},
234248
}
235249

236-
include_recipe 'boxcutter_acme::lego'
250+
# include_recipe 'boxcutter_acme::lego'
251+
# include_recipe 'boxcutter_acme::certbot'
237252

238253
node.default['fb_nginx']['enable_default_site'] = false
239254
node.default['fb_nginx']['config']['http']['proxy_send_timeout'] = '120'
@@ -246,7 +261,7 @@
246261

247262
node.default['fb_nginx']['sites']['nexus'] = {
248263
'listen 443' => 'ssl',
249-
'server_name' => 'crake-nexus.org.boxcutter.net',
264+
'server_name' => 'aws-nexus.org.boxcutter.net',
250265
'client_max_body_size' => '1G',
251266
'ssl_certificate' =>
252267
'/etc/lego/certificates/crake-nexus.org.boxcutter.net.crt',
@@ -319,20 +334,20 @@
319334
},
320335
}
321336

322-
include_recipe 'fb_nginx'
323-
324-
nexus_admin_username = Boxcutter::OnePassword.op_read(
325-
'op://Automation-Org/nexus admin blue/username',
326-
)
327-
nexus_admin_password = Boxcutter::OnePassword.op_read(
328-
'op://Automation-Org/nexus admin blue/password',
329-
)
330-
node.run_state['boxcutter_sonatype'] ||= {}
331-
node.run_state['boxcutter_sonatype']['nexus_repository'] ||= {}
332-
node.run_state['boxcutter_sonatype']['nexus_repository']['admin_username'] = nexus_admin_username
333-
node.run_state['boxcutter_sonatype']['nexus_repository']['admin_password'] = nexus_admin_password
337+
# include_recipe 'fb_nginx'
334338

335-
include_recipe 'boxcutter_sonatype::default'
339+
# nexus_admin_username = Boxcutter::OnePassword.op_read(
340+
# 'op://Automation-Org/nexus admin blue/username',
341+
# )
342+
# nexus_admin_password = Boxcutter::OnePassword.op_read(
343+
# 'op://Automation-Org/nexus admin blue/password',
344+
# )
345+
# node.run_state['boxcutter_sonatype'] ||= {}
346+
# node.run_state['boxcutter_sonatype']['nexus_repository'] ||= {}
347+
# node.run_state['boxcutter_sonatype']['nexus_repository']['admin_username'] = nexus_admin_username
348+
# node.run_state['boxcutter_sonatype']['nexus_repository']['admin_password'] = nexus_admin_password
349+
#
350+
# include_recipe 'boxcutter_sonatype::default'
336351

337352
# node['boxcutter_docker']['buildkits']['x86_64_builder'] = {
338353
# 'name' => 'x86-64-builder',

0 commit comments

Comments
 (0)