-
Notifications
You must be signed in to change notification settings - Fork 3
705 lines (559 loc) Β· 25.4 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
name: Lab Pipeline
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]
paths-ignore:
- '**/**.md'
- '**/**.png'
pull_request:
branches: ["main"]
paths-ignore:
- '**/**.md'
- '**/**.png'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# jobs for Argo, Active Directory, BIG-IP, F5XC, GoDaddy, Kubernetes, and NGINX
jobs:
Active-Directory-Terraform-Infrastructure:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure]
# Environment Variables
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_APPID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_PASSWORD }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT }}
TF_VAR_active-directory-username: ${{ secrets.ACTIVE_DIRECTORY_USER }}
TF_VAR_active-directory-password: ${{ secrets.ACTIVE_DIRECTORY_PASSWORD }}
# Where are the Terraform files
defaults:
run:
working-directory: services/active-directory/terraform/infrastructure
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.3
- name: Terraform Active-Directory-Terraform-Infrastructure fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform Active-Directory-Terraform-Infrastructure Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform Active-Directory-Terraform-Infrastructure Validate
id: validate
run: terraform validate -no-color
- name: Terraform Active-Directory-Terraform-Infrastructure Apply
id: apply
run: terraform apply --auto-approve
########################################################################################################
Argo-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, Kubernetes-Terraform-Configuration]
# Environment Variables
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_APPID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_PASSWORD }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT }}
# Where are the Terraform files
defaults:
run:
working-directory: services/argo/terraform
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- name: Azure login
uses: azure/login@v1
with:
creds: '{"clientId":"${{ secrets.AZURE_APPID }}","clientSecret":"${{ secrets.AZURE_PASSWORD }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION }}","tenantId":"${{ secrets.AZURE_TENANT }}"}'
- name: Azure Kubernetes Context
id: set-context
uses: azure/aks-set-context@v3
with:
resource-group: '${{ secrets.AZURE_AKS_RG }}'
cluster-name: '${{ secrets.AZURE_AKS_NAME }}'
- name: Setup kubectl
id: install-kubectl
uses: azure/setup-kubectl@v3
- name: HashiCorp Terraform Setup
uses: hashicorp/setup-terraform@v2
- name: Terraform Argo-Terraform-Configuration fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform Argo-Terraform-Configuration Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform Argo-Terraform-Configuration Validate
id: validate
run: terraform validate -no-color
- name: Terraform Argo-Terraform-Configuration Apply
id: apply
run: terraform apply --auto-approve
########################################################################################################
BIG-IP-Resources-Available:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, BIG-IP-Terraform-Infrastructure]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: cURL ipify.org
run: curl 'https://api.ipify.org?format=json'
- name: cURL BIG-IP
run: curl --max-time 10 -u ${{ secrets.BIGIP_USER }}:${{ secrets.BIGIP_PASSWORD }} -X GET -k https://${{ secrets.BIGIP_HOSTNAME }}/mgmt/tm/sys/ready/
BIG-IP-Ansible-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, BIG-IP-Resources-Available]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install PIP
run: sudo apt-get install -y python3-pip
- name: Install apt-get dependencies
run: sudo pip3 install jmespath
- name: Setup ansible
run: |
ansible --version
pipx inject ansible-core jmespath
- name: Working directory
run: pwd
# - name: Run ansible-lint
# # replace `main` with any valid ref, or tags like `v6`
# uses: ansible-community/ansible-lint-action@main
# # optional:
# with:
# path: "/home/runner/work/lab/lab/big-ip/ansible/configuration/playbooks/" # <-- only one value is allowed
- name: Run Ansible Playbooks
uses: dawidd6/action-ansible-playbook@v2
with:
# Optional, additional flags to pass to ansible-playbook
options: |
--extra-vars "@../defaults/main.yaml"
--extra-vars "BIGIPhost01=${{ secrets.BIGIP_HOSTNAME }}"
--extra-vars "BIGIPadminUsername=${{ secrets.BIGIP_USER }}"
--extra-vars "BIGIPadminPassword=${{ secrets.BIGIP_PASSWORD }}"
--extra-vars "BIGIPAKSUsername=${{ secrets.BIGIP_AKS_USER }}"
--extra-vars "BIGIPAKSPassword=${{ secrets.BIGIP_AKS_PASSWORD }}"
--extra-vars "otel_host=${{ secrets.OTEL_HOST }}"
--extra-vars "otel_token=${{ secrets.OTEL_TOKEN }}"
# --verbose -vvvv
# Required, playbook filepath
playbook: "big-ip-playbook.yaml"
# Optional, directory where playbooks live
directory: "./big-ip/ansible/configuration/playbooks"
BIG-IP-Terraform-Infrastructure:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Active-Directory-Terraform-Infrastructure]
# Environment Variables
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_APPID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_PASSWORD }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BIGIP_USER: ${{ secrets.BIGIP_USER }}
BIGIP_PASSWORD: ${{ secrets.BIGIP_PASSWORD }}
TF_VAR_allowed_ips: ${{ secrets.ALLOWED_IPS }}
TF_VAR_big-ip-username: ${{ secrets.BIGIP_USER }}
TF_VAR_big-ip-password: ${{ secrets.BIGIP_PASSWORD }}
# Where are the Terraform files
defaults:
run:
working-directory: big-ip/terraform/infrastructure
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.3
- name: Terraform BIG-IP-Terraform-Infrastructure fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform BIG-IP-Terraform-Infrastructure Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform BIG-IP-Terraform-Infrastructure Validate
id: validate
run: terraform validate -no-color
- name: Terraform BIG-IP-Terraform-Infrastructure Apply
id: apply
run: terraform apply --auto-approve
BIG-IP-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, BIG-IP-Ansible-Configuration]
# Environment Variables
env:
BIGIP_USER: ${{ secrets.BIGIP_USER }}
BIGIP_PASSWORD: ${{ secrets.BIGIP_PASSWORD }}
BIGIP_HOST: ${{ secrets.BIGIP_HOSTNAME }}
TF_VAR_ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
TF_VAR_ad_service_ldap_password: ${{ secrets.AD_SERVICE_LDAP_PASSWORD }}
# Where are the Terraform files
defaults:
run:
working-directory: big-ip/terraform/configuration
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.3
- name: Terraform BIG-IP-Terraform-Configuration fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform BIG-IP-Terraform-Configuration Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform BIG-IP-Terraform-Configuration Validate
id: validate
run: terraform validate -no-color
- name: Terraform BIG-IP-Terraform-Configuration Apply
id: apply
run: terraform apply --auto-approve
########################################################################################################
F5XC-Resources-Available:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- name: cURL ipify.org
run: curl 'https://api.ipify.org?format=json'
- name: cURL F5XC
run: curl --max-time 10 --cert-type P12 --cert certs/${{ secrets.VES_HOSTNAME }}.api-creds.p12:${{ secrets.VES_P12_PASSWORD }} -X GET https://${{ secrets.VES_HOSTNAME }}/api/web/namespaces/j-calalang
F5XC-Terraform-Infrastructure:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, F5XC-Resources-Available]
# Environment Variables
env:
TF_VAR_f5xc-cloud-credential: ${{ secrets.F5XC_CLOUD_CREDENTIAL }}
TF_VAR_f5xc-customer-edge-ssh-key: ${{ secrets.F5XC_CUSTOMER_EDGE_SSH_KEY }}
VES_P12_PASSWORD: ${{ secrets.VES_P12_PASSWORD }}
# Where are the Terraform files
defaults:
run:
working-directory: distributed-cloud/terraform/infrastructure
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.3
- name: Terraform F5XC-Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform F5XC-Terraform Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform F5XC-Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform F5XC-Terraform Apply
id: apply
run: terraform apply --auto-approve
F5XC-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, F5XC-Resources-Available, F5XC-Terraform-Infrastructure]
# Environment Variables
env:
TF_VAR_jwk-calalang-net: ${{ secrets.JWK_CALALANG_NET }}
TF_VAR_wildcard-calalang-net-certificate: ${{ secrets.CALALANG_NET_CERT }}
TF_VAR_wildcard-calalang-net-key: ${{ secrets.CALALANG_NET_KEY }}
VES_P12_PASSWORD: ${{ secrets.VES_P12_PASSWORD }}
# Where are the Terraform files
defaults:
run:
working-directory: distributed-cloud/terraform/configuration
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.3
- name: Terraform F5XC-Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform F5XC-Terraform Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform F5XC-Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform F5XC-Terraform Apply
id: apply
run: terraform apply --auto-approve
########################################################################################################
GoDaddy-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Environment Variables
env:
GODADDY_API_KEY: ${{ secrets.GODADDY_API_KEY }}
GODADDY_API_SECRET: ${{ secrets.GODADDY_API_SECRET }}
# Where are the Terraform files
defaults:
run:
working-directory: godaddy/terraform/
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.3
- name: Terraform GoDaddy-Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform GoDaddy-Terraform Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform GoDaddy-Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform GoDaddy-Terraform Apply
id: apply
run: terraform apply --auto-approve
########################################################################################################
Kubernetes-Terraform-Infrastructure:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure]
# Environment Variables
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_APPID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_PASSWORD }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT }}
# Where are the Terraform files
defaults:
run:
working-directory: kubernetes/terraform/infrastructure
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- name: HashiCorp Terraform Setup
uses: hashicorp/setup-terraform@v2
- name: Terraform Kubernetes-Terraform-Infrastructure fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform Kubernetes-Terraform-Infrastructure Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform Kubernetes-Terraform-Infrastructure Validate
id: validate
run: terraform validate -no-color
- name: Terraform Kubernetes-Terraform-Infrastructure Apply
id: apply
run: terraform apply --auto-approve
Kubernetes-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, Kubernetes-Terraform-Infrastructure]
# Environment Variables
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_APPID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_PASSWORD }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT }}
TF_VAR_f5xc_site_token: ${{ secrets.F5XC_SITE_TOKEN }}
TF_VAR_nginx_repo_jwt: ${{ secrets.NGINX_REPO_JWT }}
TF_VAR_bigip_aks_username: ${{ secrets.BIGIP_AKS_USER }}
TF_VAR_bigip_aks_password: ${{ secrets.BIGIP_AKS_PASSWORD }}
TF_VAR_ves_vk8s_context: ${{ secrets.VES_VK8S_CONTEXT }}
TF_VAR_ves_vk8s_client_certificate: ${{ secrets.VES_VK8S_CLIENT_CERTIFICATE }}
TF_VAR_ves_vk8s_client_key: ${{ secrets.VES_VK8S_CLIENT_KEY }}
TF_VAR_ves_vk8s_cluster_ca_certificate: ${{ secrets.VES_VK8S_CLUSTER_CA_CERTIFICATE }}
TF_VAR_ves_vk8s_server: ${{ secrets.VES_VK8S_SERVER }}
# Where are the Terraform files
defaults:
run:
working-directory: kubernetes/terraform/configuration
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- name: Azure login
uses: azure/login@v1
with:
creds: '{"clientId":"${{ secrets.AZURE_APPID }}","clientSecret":"${{ secrets.AZURE_PASSWORD }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION }}","tenantId":"${{ secrets.AZURE_TENANT }}"}'
- name: Azure Kubernetes Context
id: set-context
uses: azure/aks-set-context@v3
with:
resource-group: '${{ secrets.AZURE_AKS_RG }}'
cluster-name: '${{ secrets.AZURE_AKS_NAME }}'
- name: Setup kubectl
id: install-kubectl
uses: azure/setup-kubectl@v3
- name: Add argo-cd charts
id: argo-cd-add
run: helm repo add argo https://argoproj.github.io/argo-helm
continue-on-error: false
- name: Add f5networks charts
id: f5networks-add
run: helm repo add f5-stable https://f5networks.github.io/charts/stable
continue-on-error: false
- name: Add nginxinc charts
id: nginxinc-add
run: helm repo add nginx-stable https://helm.nginx.com/stable
continue-on-error: false
- name: Update charts
id: charts-update
run: helm repo update
continue-on-error: false
- name: HashiCorp Terraform Setup
uses: hashicorp/setup-terraform@v2
- name: Terraform Kubernetes-Terraform-Configuration fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform Kubernetes-Terraform-Configuration Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform Kubernetes-Terraform-Configuration Validate
id: validate
run: terraform validate -no-color
- name: Terraform Kubernetes-Terraform-Configuration Apply
id: apply
run: terraform apply --auto-approve
######################################################################################################
Cloud-Network-Terraform-Infrastructure:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Environment Variables
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_APPID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_PASSWORD }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Where are the Terraform files
defaults:
run:
working-directory: networking/terraform/infrastructure
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.3
- name: Terraform Cloud-Network-Terraform-Infrastructure fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform Cloud-Network-Terraform-Infrastructure Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform Cloud-Network-Terraform-Infrastructure Validate
id: validate
run: terraform validate -no-color
- name: Terraform Cloud-Network-Terraform-Infrastructure Apply
id: apply
run: terraform apply --auto-approve
######################################################################################################
NMS-Resources-Available:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, NGINX-Terraform-Infrastructure]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- name: cURL ipify.org
run: curl 'https://api.ipify.org?format=json'
- name: cURL NMS
run: curl --max-time 10 -u ${{ secrets.NMS_USER}}:${{ secrets.NMS_PASSWORD }} -H "token:${{ secrets.NMS_TOKEN }}" -X GET https://${{ secrets.NMS_HOSTNAME }}/api/platform/v1/instances
NMS-Ansible-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Cloud-Network-Terraform-Infrastructure, NMS-Resources-Available]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install PIP
run: sudo apt-get install -y python3-pip
- name: Install apt-get dependencies
run: sudo pip3 install jmespath
- name: Setup ansible
run: |
ansible --version
pipx inject ansible-core jmespath
- name: Working directory
run: pwd
# - name: Run ansible-lint
# # replace `main` with any valid ref, or tags like `v6`
# uses: ansible-community/ansible-lint-action@main
# # optional:
# with:
# path: "/home/runner/work/lab/lab/nginx/ansible/configuration/playbooks/" # <-- only one value is allowed
- name: Run Ansible Playbooks
uses: dawidd6/action-ansible-playbook@v2
with:
# Optional, additional flags to pass to ansible-playbook
options: |
--extra-vars "@../defaults/main.yaml"
--extra-vars "NMShost01=${{ secrets.NMS_HOSTNAME }}"
--extra-vars "NMSadminUsername=${{ secrets.NMS_USER}}"
--extra-vars "NMSadminPassword=${{ secrets.NMS_PASSWORD }}"
--extra-vars "NMSToken=${{ secrets.NMS_TOKEN }}"
--extra-vars "NMSinstanceGroup=${{ secrets.NMS_INSTANCE_GROUP }}"
# --verbose -vvvv
# Required, playbook filepath
playbook: "nginx.yaml"
# Optional, directory where playbooks live
directory: "./nginx/ansible/configuration/playbooks"
NGINX-Terraform-Infrastructure:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [Active-Directory-Terraform-Infrastructure]
# Environment Variables
env:
ARM_CLIENT_ID: ${{ secrets.AZURE_APPID }}
ARM_CLIENT_SECRET: ${{ secrets.AZURE_PASSWORD }}
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT }}
TF_VAR_nginx_username: ${{ secrets.NGINX_USER }}
TF_VAR_nginx_password: ${{ secrets.NGINX_PASSWORD }}
# Where are the Terraform files
defaults:
run:
working-directory: nginx/terraform/infrastructure
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.6.3
- name: Terraform NGINX-Terraform-Infrastructure fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
- name: Terraform NGINX-Terraform-Infrastructure Init
id: init
run: terraform init -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
- name: Terraform NGINX-Terraform-Infrastructure Validate
id: validate
run: terraform validate -no-color
- name: Terraform NGINX-Terraform-Infrastructure Apply
id: apply
run: terraform apply --auto-approve