Skip to content

Commit

Permalink
Fix Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
simeononsecurity committed Apr 23, 2022
1 parent bb6ed4a commit 9b0c042
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
---
# tasks file for base
- name: Download {{ gitname }} to specified path only if modified

- name: Debug VARs
ansible.builtin.debug:
msg: "Gitrepo is {{ gitrepo }}"
- name: Debug VARs
ansible.builtin.debug:
msg: "Gitdir is {{ gitdir }}"
- name: Debug VARs
ansible.builtin.debug:
msg: "Gitname is {{ gitname }}"
- name: Debug VARs
ansible.builtin.debug:
msg: "Zipdir is {{ zipdir }}"

- name: Download STIG files to specified path
ansible.windows.win_get_url:
url: "{{ gitrepo }}"
dest: "{{ gitdir }}"
force: no
follow_redirects: all
force: yes

- name: Fix Windows Path Character Limit
ansible.windows.win_regedit:
Expand All @@ -13,22 +28,22 @@
data: 1
type: dword

# Unzip .zip file, recursively decompresses the contained zips and removes all unneeded compressed files after completion.
# Unzip STIG .zip file and remove all unneeded compressed files after completion.
- name: Recursively decompress zip files
community.windows.win_unzip:
src: "{{ gitdir }}"
dest: "{{ zipdir }}"
recurse: yes
delete_archive: yes

- name: Run the STIG Script
ansible.windows.win_powershell:
chdir: "{{ gitdir }}"
chdir: "{{ zipdir }}"
script: |
try{
powershell.exe -ExecutionPolicy ByPass -File "{{ zipdir }}/*.ps1"
foreach ($script in (Get-Childitem -recurse *.ps1).fullname){
Write-Output executing $script
powershell.exe -ExecutionPolicy ByPass -File "$script"
}
} Catch {
$Ansible.failed = $true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# vars file for base
gitrepo: "https://github.com/simeononsecurity/.NET-STIG-Script/archive/refs/heads/master.zip"
gitdir: " C:\\temp\\master.zip"
gitdir: "C:\\temp\\master.zip"
gitname: ".NET-STIG-Script"
zipdir: " C:\\temp\\{{ gitname }}"
zipdir: "C:\\temp\\{{ gitname }}"

0 comments on commit 9b0c042

Please sign in to comment.