-
Notifications
You must be signed in to change notification settings - Fork 3
860 lines (720 loc) Β· 30.8 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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
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"]
pull_request:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# jobs for F5XC, BIG-IP, NGINX, and NMS
jobs:
########################################################################################################
Argo-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [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 }}
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
# 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: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: argo-terraform-configuration-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: services/argo/terraform
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
# run_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -force-copy
- 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
- name: Upload Terraform Argo-Terraform-Configuration State
uses: actions/upload-artifact@v3
with:
name: argo-terraform-configuration-state
path: /home/runner/work/lab/lab/services/argo/terraform/terraform.tfstate
retention-days: 30
########################################################################################################
BIG-IP-Resources-Available:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [BIG-IP-Terraform-Infrastructure]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: cURL BIG-IP
run: curl --max-time 10 -u ${{ secrets.BIGIP_USER }}:${{ secrets.BIGIP_PASSWORD }} -X GET -k https://${{ secrets.BIGIP_HOST }}/mgmt/tm/sys/ready/
BIG-IP-Ansible-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [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: 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_HOST }}"
--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 }}"
# --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
# 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 }}
BIGIP_USER: ${{ secrets.BIGIP_USER }}
BIGIP_PASSWORD: ${{ secrets.BIGIP_PASSWORD }}
TF_VAR_big-ip-username: ${{ secrets.BIGIP_USER }}
TF_VAR_big-ip-password: ${{ secrets.BIGIP_PASSWORD }}
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
# 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.3.2
- name: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: big-ip-terraform-infrastructure-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: big-ip/terraform/infrastructure
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
# run_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -force-copy
- 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
- name: Upload Terraform BIG-IP-Terraform-Infrastructure State
uses: actions/upload-artifact@v3
with:
name: big-ip-terraform-infrastructure-state
path: /home/runner/work/lab/lab/big-ip/terraform/infrastructure/terraform.tfstate
retention-days: 30
BIG-IP-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [BIG-IP-Ansible-Configuration]
# Environment Variables
env:
BIGIP_USER: ${{ secrets.BIGIP_USER }}
BIGIP_PASSWORD: ${{ secrets.BIGIP_PASSWORD }}
BIGIP_HOST: ${{ secrets.BIGIP_HOST }}
TF_VAR_ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
TF_VAR_ad_service_ldap_password: ${{ secrets.AD_SERVICE_LDAP_PASSWORD }}
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
# 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.3.2
- name: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: big-ip-terraform-configuration-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: big-ip/terraform/configuration
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
# run_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -force-copy
- 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
- name: Upload Terraform BIG-IP-Terraform-Configuration State
uses: actions/upload-artifact@v3
with:
name: big-ip-terraform-configuration-state
path: /home/runner/work/lab/lab/big-ip/terraform/configuration/terraform.tfstate
retention-days: 30
########################################################################################################
F5XC-Resources-Available:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- 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: [F5XC-Resources-Available]
# Environment Variables
env:
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
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.3.2
- name: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: f5xc-terraform-infrastructure-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: distributed-cloud/terraform/infrastructure
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
#vrun_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -force-copy
- name: Terraform F5XC-Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform F5XC-Terraform Apply
id: apply
run: terraform apply --auto-approve
- name: Upload Terraform F5XC-Terraform State
uses: actions/upload-artifact@v3
with:
name: f5xc-terraform-infrastructure-state
path: /home/runner/work/lab/lab/distributed-cloud/terraform/infrastructure/distributed-cloud/terraform.tfstate
retention-days: 30
F5XC-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [F5XC-Resources-Available, F5XC-Terraform-Infrastructure]
# Environment Variables
env:
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
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.3.2
- name: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: f5xc-terraform-configuration-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: distributed-cloud/terraform/configuration
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
#vrun_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -force-copy
- name: Terraform F5XC-Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform F5XC-Terraform Apply
id: apply
run: terraform apply --auto-approve
- name: Upload Terraform F5XC-Terraform State
uses: actions/upload-artifact@v3
with:
name: f5xc-terraform-configuration-state
path: /home/runner/work/lab/lab/distributed-cloud/terraform/configuration/distributed-cloud/terraform.tfstate
retention-days: 30
########################################################################################################
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.3.2
- name: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: godaddy-terraform-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: godaddy/terraform/
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
# run_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -migrate-state -backend-config="organization=${{ secrets.TF_CLOUD_ORGANIZATION }}" -backend-config="hostname=${{ secrets.TF_CLOUD_HOSTNAME }}" -backend-config="token=${{ secrets.TF_CLOUD_TOKEN }}"
# run: terraform init -force-copy
- name: Terraform GoDaddy-Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform GoDaddy-Terraform Apply
id: apply
run: terraform apply --auto-approve
# - name: Upload Terraform GoDaddy-Terraform State
# uses: actions/upload-artifact@v3
# with:
# name: godaddy-terraform-state
# path: /home/runner/work/lab/lab/godaddy/terraform/godaddy/terraform.tfstate
# retention-days: 30
########################################################################################################
Kubernetes-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 }}
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
# 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: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: kubernetes-terraform-infrastructure-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: kubernetes/terraform/infrastructure
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
# run_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -force-copy
- 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
- name: Upload Terraform Kubernetes-Terraform-Infrastructure State
uses: actions/upload-artifact@v3
with:
name: kubernetes-terraform-infrastructure-state
path: /home/runner/work/lab/lab/kubernetes/terraform/infrastructure/terraform.tfstate
retention-days: 30
Kubernetes-Terraform-Configuration:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [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_host: ${{ secrets.VES_VK8S_HOST }}
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 }}
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
# 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: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: kubernetes-terraform-configuration-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: kubernetes/terraform/configuration
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
# run_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -force-copy
- 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
- name: Upload Terraform Kubernetes-Terraform-Configuration State
uses: actions/upload-artifact@v3
with:
name: kubernetes-terraform-configuration-state
path: /home/runner/work/lab/lab/kubernetes/terraform/configuration/terraform.tfstate
retention-days: 30
######################################################################################################
NMS-Resources-Available:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
needs: [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 NMS
run: curl --max-time 10 -u ${{ secrets.NMS_USERNAME }}:${{ 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: [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: 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/roles/nginx/tasks/main.yaml" # <-- 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_USERNAME }}"
--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
# 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 }}
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
# Where are the Terraform files
defaults:
run:
working-directory: nginx/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.3.2
- name: Download Terraform State
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: nginx-terraform-state
# Optional, a directory where to extract artifact(s), defaults to the current directory
path: nginx/terraform/
# Optional, defaults to current repo
check_artifacts: false
# Optional, search for the last workflow run whose stored an artifact named as in `name` input
# default false
search_artifacts: true
# Optional, run number from the workflow
# run_number: 3598306214
# Optional, choose to skip unpacking the downloaded artifact(s)
# default false
# skip_unpack: false
# Optional, choose how to exit the action if no artifact is found
# can be one of:
# "fail", "warn", "ignore"
# default fail
if_no_artifact_found: fail
- 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 -force-copy
- 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
- name: Upload Terraform NGINX-Terraform-Infrastructure State
uses: actions/upload-artifact@v3
with:
name: nginx-terraform-state
path: /home/runner/work/lab/lab/nginx/terraform/terraform.tfstate
retention-days: 30