Skip to content

Commit 1dbd375

Browse files
authored
Merge pull request #39 from ansible-lockdown/devel
devel to main v3 release
2 parents 11b8afe + 9182775 commit 1dbd375

File tree

115 files changed

+9236
-5528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+9236
-5528
lines changed

.ansible-lint

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
---
2+
13
parseable: true
24
quiet: true
35
skip_list:
46
- 'schema'
57
- 'no-changed-when'
68
- 'var-spacing'
7-
- 'fqcn-builtins'
89
- 'experimental'
910
- 'name[play]'
1011
- 'name[casing]'
1112
- 'name[template]'
12-
- 'fqcn[action]'
13+
- 'key-order[task]'
1314
- '204'
1415
- '305'
1516
- '303'

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/feature-request-or-enhancement.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/pull_request_template.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/AMAZON2.tfvars

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Amazon Linux 2
2+
ami_id = "ami-03e0b06f01d45a4eb"
3+
ami_os = "AmazonLinux2"
4+
ami_username = "ec2-user"
5+
ami_user_home = "/home/ec2-user"
6+
benchmark_os = "Amazon2"

.github/workflows/OS.tfvars

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
---
2+
3+
name: Devel pipeline
4+
5+
on: # yamllint disable-line rule:truthy
6+
pull_request_target:
7+
types: [opened, reopened, synchronize]
8+
branches:
9+
- devel
10+
paths:
11+
- '**.yml'
12+
- '**.sh'
13+
- '**.j2'
14+
- '**.ps1'
15+
- '**.cfg'
16+
# Allow manual running of workflow
17+
workflow_dispatch:
18+
19+
# Allow permissions for AWS auth
20+
permissions:
21+
id-token: write
22+
contents: read
23+
pull-requests: read
24+
25+
# A workflow run is made up of one or more jobs
26+
# that can run sequentially or in parallel
27+
jobs:
28+
# This will create messages for first time contributers and direct them to the Discord server
29+
welcome:
30+
runs-on: self-hosted
31+
32+
steps:
33+
- uses: actions/first-interaction@main
34+
with:
35+
repo-token: ${{ secrets.GITHUB_TOKEN }}
36+
pr-message: |-
37+
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
38+
Please join in the conversation happening on the [Discord Server](https://www.lockdownenterprise.com/discord) as well.
39+
40+
# This workflow contains a single job that tests the playbook
41+
playbook-test:
42+
# The type of runner that the job will run on
43+
runs-on: self-hosted
44+
env:
45+
ENABLE_DEBUG: ${{ vars.ENABLE_DEBUG }}
46+
# Imported as a variable by terraform
47+
TF_VAR_repository: ${{ github.event.repository.name }}
48+
AWS_REGION: "us-east-1"
49+
ANSIBLE_VERSION: ${{ vars.ANSIBLE_RUNNER_VERSION }}
50+
defaults:
51+
run:
52+
shell: bash
53+
working-directory: .github/workflows/github_linux_IaC
54+
# working-directory: .github/workflows
55+
56+
steps:
57+
58+
- name: Git clone the lockdown repository to test
59+
uses: actions/checkout@v4
60+
with:
61+
ref: ${{ github.event.pull_request.head.sha }}
62+
63+
- name: If a variable for IAC_BRANCH is set use that branch
64+
working-directory: .github/workflows
65+
run: |
66+
if [ ${{ vars.IAC_BRANCH }} != '' ]; then
67+
echo "IAC_BRANCH=${{ vars.IAC_BRANCH }}" >> $GITHUB_ENV
68+
echo "Pipeline using the following IAC branch ${{ vars.IAC_BRANCH }}"
69+
else
70+
echo IAC_BRANCH=main >> $GITHUB_ENV
71+
fi
72+
73+
74+
# Pull in terraform code for linux servers
75+
- name: Clone GitHub IaC plan
76+
uses: actions/checkout@v4
77+
with:
78+
repository: ansible-lockdown/github_linux_IaC
79+
path: .github/workflows/github_linux_IaC
80+
ref: ${{ env.IAC_BRANCH }}
81+
82+
# Uses dedicated restricted role and policy to enable this only for this task
83+
# No credentials are part of github for AWS auth
84+
- name: configure aws credentials
85+
uses: aws-actions/configure-aws-credentials@main
86+
with:
87+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
88+
role-session-name: ${{ secrets.AWS_ROLE_SESSION }}
89+
aws-region: ${{ env.AWS_REGION }}
90+
91+
- name: DEBUG - Show IaC files
92+
if: env.ENABLE_DEBUG == 'true'
93+
run: |
94+
echo "OSVAR = $OSVAR"
95+
echo "benchmark_type = $benchmark_type"
96+
echo "PRIVSUBNET_ID = $AWS_PRIVSUBNET_ID"
97+
echo "VPC_ID" = $AWS_VPC_SECGRP_ID"
98+
pwd
99+
ls
100+
env:
101+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
102+
OSVAR: ${{ vars.OSVAR }}
103+
benchmark_type: ${{ vars.BENCHMARK_TYPE }}
104+
PRIVSUBNET_ID: ${{ secrets.AWS_PRIVSUBNET_ID }}
105+
VPC_ID: ${{ secrets.AWS_VPC_SECGRP_ID }}
106+
107+
- name: Tofu init
108+
id: init
109+
run: tofu init
110+
env:
111+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
112+
OSVAR: ${{ vars.OSVAR }}
113+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
114+
115+
- name: Tofu validate
116+
id: validate
117+
run: tofu validate
118+
env:
119+
# Imported from GitHub variables this is used to load the relevant OS.tfvars file
120+
OSVAR: ${{ vars.OSVAR }}
121+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
122+
123+
- name: Tofu apply
124+
id: apply
125+
env:
126+
OSVAR: ${{ vars.OSVAR }}
127+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
128+
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
129+
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
130+
run: tofu apply -var-file "${OSVAR}.tfvars" --auto-approve -input=false
131+
132+
## Debug Section
133+
- name: DEBUG - Show Ansible hostfile
134+
if: env.ENABLE_DEBUG == 'true'
135+
run: cat hosts.yml
136+
137+
# Aws deployments taking a while to come up insert sleep or playbook fails
138+
139+
- name: Sleep to allow system to come up
140+
run: sleep ${{ vars.BUILD_SLEEPTIME }}
141+
142+
# Run the Ansible playbook
143+
- name: Run_Ansible_Playbook
144+
env:
145+
ANSIBLE_HOST_KEY_CHECKING: "false"
146+
ANSIBLE_DEPRECATION_WARNINGS: "false"
147+
run: |
148+
/opt/ansible_${{ env.ANSIBLE_VERSION }}_venv/bin/ansible-playbook -i hosts.yml --private-key ~/.ssh/le_runner ../../../site.yml
149+
150+
# Remove test system - User secrets to keep if necessary
151+
152+
- name: Tofu Destroy
153+
if: always() && env.ENABLE_DEBUG == 'false'
154+
env:
155+
OSVAR: ${{ vars.OSVAR }}
156+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
157+
TF_VAR_privsubnet_id: ${{ secrets.AWS_PRIVSUBNET_ID }}
158+
TF_VAR_vpc_secgrp_id: ${{ secrets.AWS_VPC_SECGRP_ID }}
159+
run: tofu destroy -var-file "${OSVAR}.tfvars" --auto-approve -input=false

.github/workflows/github_networks.tf

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/github_vars.tfvars

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)