Skip to content

Commit a799d10

Browse files
Merge pull request #3 from ansible-lockdown/devel
2023 September Devel to Main
2 parents 4184293 + abda5cb commit a799d10

25 files changed

+7853
-2
lines changed

.ansible-lint

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
3+
parseable: true
4+
quiet: true
5+
skip_list:
6+
- 'schema'
7+
- 'no-changed-when'
8+
- 'experimental'
9+
- 'name[casing]'
10+
- 'name[template]'
11+
- 'jinja[spacing]'
12+
- 'yaml[line-length]'
13+
- 'key-order[task]'
14+
- 'var-naming' # Older playbook no new release
15+
- '204'
16+
- '208'
17+
- '305'
18+
- '303'
19+
- '403'
20+
- '306'
21+
- '602'
22+
use_default_rules: true
23+
verbosity: 0

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# adding github settings to show correct language
2+
*.sh linguist-detectable=true
3+
*.yml linguist-detectable=true
4+
*.ps1 linguist-detectable=true
5+
*.j2 linguist-detectable=true
6+
*.md linguist-documentation
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
3+
# This is a basic workflow to help you get started with Actions
4+
5+
name: Devel Pipeline Validation
6+
7+
# Controls when the action will run.
8+
# Triggers the workflow on push or pull request
9+
# events but only for the devel branch
10+
on: # yamllint disable-line rule:truthy
11+
pull_request_target:
12+
types: [opened, reopened, synchronize]
13+
branches:
14+
- devel
15+
paths:
16+
- '**.yml'
17+
- '**.sh'
18+
- '**.j2'
19+
- '**.ps1'
20+
- '**.cfg'
21+
22+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
23+
# This setion contains all the jobs below that are running in the workflow.
24+
jobs:
25+
# This will create messages for first time contributers and direct them to the Discord server
26+
welcome:
27+
# The type of runner that the job will run on.
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/first-interaction@main
31+
with:
32+
repo-token: ${{ secrets.GITHUB_TOKEN }}
33+
pr-message: |-
34+
Congrats on opening your first pull request and thank you for taking the time to help improve Ansible-Lockdown!
35+
Please join in the conversation happening on the [Discord Server](https://discord.io/ansible-lockdown) as well.
36+
37+
# This workflow will run terraform to load a instance in azure to test the playbook against a live cloud based instance.
38+
playbook-test:
39+
# The type of runner that the job will run on.
40+
runs-on: ubuntu-latest
41+
42+
env:
43+
ENABLE_DEBUG: false
44+
# Imported as a variable by terraform.
45+
TF_VAR_repository: ${{ github.event.repository.name }}
46+
ARM_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
47+
ARM_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
48+
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
49+
ARM_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
50+
WIN_USERNAME: ${{ secrets.WIN_USERNAME }}
51+
WIN_PASSWORD: ${{ secrets.WIN_PASSWORD }}
52+
53+
defaults:
54+
run:
55+
shell: bash
56+
working-directory: .github/workflows/github_windows_IaC
57+
58+
# Steps represent a sequence of tasks that will be executed as part of the job.
59+
steps:
60+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
61+
- name: Clone ${{ github.event.repository.name }}
62+
uses: actions/checkout@v3
63+
with:
64+
ref: ${{ github.event.pull_request.head.sha }}
65+
66+
# Pull In Terraform Code For Windows Azure
67+
- name: Clone github IaC plan
68+
uses: actions/checkout@v3
69+
with:
70+
repository: ansible-lockdown/github_windows_IaC
71+
path: .github/workflows/github_windows_IaC
72+
73+
# Sensitive Data Stored And Passed To Terraform
74+
# Default Working Dir Defined In Defaults Above.
75+
- name: user details
76+
run: echo "{\"username\":\"${WIN_USERNAME}\",\"password\":\"${WIN_PASSWORD}\"}" >> sensitive_info.json
77+
78+
# Show the Os Var and Benchmark Type And Load
79+
- name: DEBUG - Show IaC files
80+
if: env.ENABLE_DEBUG == 'true'
81+
run: |
82+
echo "OSVAR = $OSVAR"
83+
echo "benchmark_type = $benchmark_type"
84+
pwd
85+
ls
86+
env:
87+
# Imported from github variables this is used to load the relvent OS.tfvars file
88+
OSVAR: ${{ vars.OSVAR }}
89+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
90+
91+
# Initialize The Terraform Working Directory
92+
- name: Terraform_Init
93+
id: init
94+
run: terraform init
95+
env:
96+
# Imported from github variables this is used to load the relvent OS.tfvars file
97+
OSVAR: ${{ vars.OSVAR }}
98+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
99+
100+
# Validate The Syntax Of Terraform Files
101+
- name: Terraform_Validate
102+
id: validate
103+
run: terraform validate
104+
env:
105+
# Imported from github variables this is used to load the relvent OS.tfvars file
106+
OSVAR: ${{ vars.OSVAR }}
107+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
108+
109+
# Execute The Actions And Build Azure Server
110+
- name: Terraform_Apply
111+
id: apply
112+
env:
113+
# Imported from github variables this is used to load the relvent OS.tfvars file
114+
WIN_USERNAME: ${{ secrets.WIN_USERNAME }}
115+
WIN_PASSWORD: ${{ secrets.WIN_PASSWORD }}
116+
OSVAR: ${{ vars.OSVAR }}
117+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
118+
run: terraform apply -var-file "${OSVAR}.tfvars" --auto-approve
119+
120+
# Debug Section
121+
- name: DEBUG - Show Ansible Hostfile
122+
if: env.ENABLE_DEBUG == 'true'
123+
run: cat hosts.yml
124+
125+
# Run the Ansible Playbook
126+
- name: Run_Ansible_Playbook
127+
uses: arillso/action.playbook@master
128+
with:
129+
playbook: site.yml
130+
inventory: .github/workflows/github_windows_IaC/hosts.yml
131+
galaxy_file: collections/requirements.yml
132+
# verbose: 3
133+
env:
134+
ANSIBLE_HOST_KEY_CHECKING: "false"
135+
ANSIBLE_DEPRECATION_WARNINGS: "false"
136+
137+
# Destroy The Azure Test System
138+
- name: Terraform_Destroy
139+
if: always() && env.ENABLE_DEBUG == 'false'
140+
env:
141+
OSVAR: ${{ vars.OSVAR }}
142+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
143+
run: terraform destroy -var-file "${OSVAR}.tfvars" --auto-approve
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
3+
# This is a basic workflow to help you get started with Actions
4+
5+
name: Main Pipeline Validation
6+
7+
# Controls when the action will run.
8+
# Triggers the workflow on push or pull request
9+
# events but only for the devel branch
10+
on: # yamllint disable-line rule:truthy
11+
pull_request_target:
12+
types: [opened, reopened, synchronize]
13+
branches:
14+
- main
15+
paths:
16+
- '**.yml'
17+
- '**.sh'
18+
- '**.j2'
19+
- '**.ps1'
20+
- '**.cfg'
21+
22+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
23+
# This setion contains all the jobs below that are running in the workflow.
24+
jobs:
25+
# This workflow will run terraform to load a instance in azure to test the playbook against a live cloud based instance.
26+
playbook-test:
27+
# The type of runner that the job will run on.
28+
runs-on: ubuntu-latest
29+
30+
env:
31+
ENABLE_DEBUG: false
32+
# Imported as a variable by terraform.
33+
TF_VAR_repository: ${{ github.event.repository.name }}
34+
ARM_CLIENT_ID: ${{ secrets.AZURE_AD_CLIENT_ID }}
35+
ARM_CLIENT_SECRET: ${{ secrets.AZURE_AD_CLIENT_SECRET }}
36+
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
37+
ARM_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
38+
WIN_USERNAME: ${{ secrets.WIN_USERNAME }}
39+
WIN_PASSWORD: ${{ secrets.WIN_PASSWORD }}
40+
41+
defaults:
42+
run:
43+
shell: bash
44+
working-directory: .github/workflows/github_windows_IaC
45+
46+
# Steps represent a sequence of tasks that will be executed as part of the job.
47+
steps:
48+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
49+
- name: Clone ${{ github.event.repository.name }}
50+
uses: actions/checkout@v3
51+
with:
52+
ref: ${{ github.event.pull_request.head.sha }}
53+
54+
# Pull In Terraform Code For Windows Azure
55+
- name: Clone github IaC plan
56+
uses: actions/checkout@v3
57+
with:
58+
repository: ansible-lockdown/github_windows_IaC
59+
path: .github/workflows/github_windows_IaC
60+
61+
# Sensitive Data Stored And Passed To Terraform
62+
# Default Working Dir Defined In Defaults Above.
63+
- name: user details
64+
run: echo "{\"username\":\"${WIN_USERNAME}\",\"password\":\"${WIN_PASSWORD}\"}" >> sensitive_info.json
65+
66+
# Show the Os Var and Benchmark Type And Load
67+
- name: DEBUG - Show IaC files
68+
if: env.ENABLE_DEBUG == 'true'
69+
run: |
70+
echo "OSVAR = $OSVAR"
71+
echo "benchmark_type = $benchmark_type"
72+
pwd
73+
ls
74+
env:
75+
# Imported from github variables this is used to load the relvent OS.tfvars file
76+
OSVAR: ${{ vars.OSVAR }}
77+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
78+
79+
# Initialize The Terraform Working Directory
80+
- name: Terraform_Init
81+
id: init
82+
run: terraform init
83+
env:
84+
# Imported from github variables this is used to load the relvent OS.tfvars file
85+
OSVAR: ${{ vars.OSVAR }}
86+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
87+
88+
# Validate The Syntax Of Terraform Files
89+
- name: Terraform_Validate
90+
id: validate
91+
run: terraform validate
92+
env:
93+
# Imported from github variables this is used to load the relvent OS.tfvars file
94+
OSVAR: ${{ vars.OSVAR }}
95+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
96+
97+
# Execute The Actions And Build Azure Server
98+
- name: Terraform_Apply
99+
id: apply
100+
env:
101+
# Imported from github variables this is used to load the relvent OS.tfvars file
102+
WIN_USERNAME: ${{ secrets.WIN_USERNAME }}
103+
WIN_PASSWORD: ${{ secrets.WIN_PASSWORD }}
104+
OSVAR: ${{ vars.OSVAR }}
105+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
106+
run: terraform apply -var-file "${OSVAR}.tfvars" --auto-approve
107+
108+
# Debug Section
109+
- name: DEBUG - Show Ansible Hostfile
110+
if: env.ENABLE_DEBUG == 'true'
111+
run: cat hosts.yml
112+
113+
# Run the Ansible Playbook
114+
- name: Run_Ansible_Playbook
115+
uses: arillso/action.playbook@master
116+
with:
117+
playbook: site.yml
118+
inventory: .github/workflows/github_windows_IaC/hosts.yml
119+
galaxy_file: collections/requirements.yml
120+
# verbose: 3
121+
env:
122+
ANSIBLE_HOST_KEY_CHECKING: "false"
123+
ANSIBLE_DEPRECATION_WARNINGS: "false"
124+
125+
# Destroy The Azure Test System
126+
- name: Terraform_Destroy
127+
if: always() && env.ENABLE_DEBUG == 'false'
128+
env:
129+
OSVAR: ${{ vars.OSVAR }}
130+
TF_VAR_benchmark_type: ${{ vars.BENCHMARK_TYPE }}
131+
run: terraform destroy -var-file "${OSVAR}.tfvars" --auto-approve
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Update Galaxy
4+
5+
# Controls when the action will run.
6+
# Triggers the workflow on push or pull request
7+
# events but only for the devel branch
8+
on: # yamllint disable-line rule:truthy
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
update_role:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout V3
18+
uses: actions/checkout@v3
19+
20+
- name: Update Galaxy
21+
uses: robertdebock/galaxy-action@master
22+
with:
23+
galaxy_api_key: ${{ secrets.GALAXY_API_KEY }}
24+
git_branch: main

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.env
2+
*.log
3+
*.retry
4+
.vagrant
5+
tests/*redhat-subscription
6+
tests/Dockerfile
7+
*.iso
8+
*.box
9+
packer_cache
10+
delete*
11+
ignore*
12+
# VSCode
13+
.vscode
14+
vagrant
15+
16+
# Byte-compiled / optimized / DLL files
17+
__pycache__/
18+
*.py[cod]
19+
*$py.class
20+
21+
# DS_Store
22+
.DS_Store
23+
._*
24+
25+
# Linux Editors
26+
*~
27+
\#*\#
28+
/.emacs.desktop
29+
/.emacs.desktop.lock
30+
.elc
31+
auto-save-list
32+
tramp
33+
.\#*
34+
*.swp
35+
*.swo
36+
rh-creds.env
37+
travis.env
38+
39+
# Lockdown-specific
40+
benchparse/
41+
*xccdf.xml
42+
*.retry
43+
44+
# GitHub Action/Workflow files
45+
.github/

0 commit comments

Comments
 (0)