more linting

This commit is contained in:
willtome
2023-03-08 14:52:58 -05:00
parent 049b94aec4
commit d7d771c357
12 changed files with 44 additions and 32 deletions

View File

@@ -2,6 +2,13 @@
name: Ansible Lint name: Ansible Lint
on: [push, pull_request] on: [push, pull_request]
env:
ANSIBLE_GALAXY_SERVER_LIST: ah,galaxy
ANSIBLE_GALAXY_SERVER_AH_URL: ${{ vars.ANSIBLE_GALAXY_SERVER_AH_URL }}
ANSIBLE_GALAXY_SERVER_AH_AUTH_URL: ${{ vars.ANSIBLE_GALAXY_SERVER_AH_AUTH_URL }}
ANSIBLE_GALAXY_SERVER_AH_TOKEN: ${{ secrets.ANSIBLE_GALAXY_SERVER_AH_TOKEN }}
ANSIBLE_GALAXY_SERVER_GALAXY_URL: ${{ vars.ANSIBLE_GALAXY_SERVER_GALAXY_URL }}
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -14,9 +21,3 @@ jobs:
- name: Run ansible-lint - name: Run ansible-lint
uses: ansible/ansible-lint-action@v6 uses: ansible/ansible-lint-action@v6
env:
ANSIBLE_GALAXY_SERVER_LIST: ah,galaxy
ANSIBLE_GALAXY_SERVER_AH_URL: ${{ vars.ANSIBLE_GALAXY_SERVER_AH_URL }}
ANSIBLE_GALAXY_SERVER_AH_AUTH_URL: ${{ vars.ANSIBLE_GALAXY_SERVER_AH_AUTH_URL }}
ANSIBLE_GALAXY_SERVER_AH_TOKEN: ${{ secrets.ANSIBLE_GALAXY_SERVER_AH_TOKEN }}
ANSIBLE_GALAXY_SERVER_GALAXY_URL: ${{ vars.ANSIBLE_GALAXY_SERVER_GALAXY_URL }}

View File

@@ -2,12 +2,13 @@
ansible.builtin.file: ansible.builtin.file:
path: "{{ file_path }}" path: "{{ file_path }}"
state: directory state: directory
mode: '0755' mode: "0755"
- name: Create HTML report - name: Create HTML report
ansible.builtin.template: ansible.builtin.template:
src: report.j2 src: report.j2
dest: "{{ file_path }}/network.html" dest: "{{ file_path }}/network.html"
mode: "0644"
check_mode: false check_mode: false
- name: Copy CSS over - name: Copy CSS over
@@ -15,6 +16,7 @@
src: "css" src: "css"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0775"
check_mode: false check_mode: false
- name: Copy logos over - name: Copy logos over
@@ -22,6 +24,7 @@
src: "{{ item }}" src: "{{ item }}"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0644"
loop: loop:
- "webpage_logo.png" - "webpage_logo.png"
- "redhat-ansible-logo.svg" - "redhat-ansible-logo.svg"

View File

@@ -2,18 +2,21 @@
ansible.builtin.template: ansible.builtin.template:
src: report.j2 src: report.j2
dest: "{{ file_path }}/windows.html" dest: "{{ file_path }}/windows.html"
mode: "0644"
- name: Copy CSS over - name: Copy CSS over
ansible.builtin.copy: ansible.builtin.copy:
src: "css" src: "css"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0755"
- name: Copy logos over - name: Copy logos over
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0644"
loop: loop:
- "webpage_logo.png" - "webpage_logo.png"
- "redhat-ansible-logo.svg" - "redhat-ansible-logo.svg"

View File

@@ -2,6 +2,7 @@
ansible.builtin.template: ansible.builtin.template:
src: report.j2 src: report.j2
dest: "{{ file_path }}/windowspatch.html" dest: "{{ file_path }}/windowspatch.html"
mode: "0644"
check_mode: false check_mode: false
- name: Copy CSS over - name: Copy CSS over
@@ -9,6 +10,7 @@
src: "css" src: "css"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0775"
check_mode: false check_mode: false
- name: Copy logo over - name: Copy logo over
@@ -16,23 +18,9 @@
src: "webpage_logo.png" src: "webpage_logo.png"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0644"
check_mode: false check_mode: false
- name: Display link to Patch report - name: Display link to Patch report
ansible.builtin.debug: ansible.builtin.debug:
msg: "Please go to http://{{ ansible_host }}/windowspatch.html" msg: "Please go to http://{{ ansible_host }}/windowspatch.html"
- name: Send Report via E-mail
community.general.mail:
host: "{{ EMAIL_HOST }}"
username: "{{ EMAIL_USERNAME }}"
password: "{{ EMAIL_PASSWORD }}"
port: "{{ EMAIL_PORT }}"
subject: "Windows Patching Report"
body: "{{ lookup('template', 'report.j2') }}"
from: "{{ EMAIL_FROM }}"
to: "{{ EMAIL_TO }}"
subtype: html
delegate_to: localhost
become: false
check_mode: false

View File

@@ -34,4 +34,4 @@
ansible.builtin.reboot: ansible.builtin.reboot:
when: when:
- result.rc == 1 - result.rc == 1
- allow_reboot == true - allow_reboot

View File

@@ -2,6 +2,7 @@
ansible.builtin.template: ansible.builtin.template:
src: report.j2 src: report.j2
dest: "{{ file_path }}/linux.html" dest: "{{ file_path }}/linux.html"
mode: "0644"
check_mode: false check_mode: false
- name: Copy CSS over - name: Copy CSS over
@@ -9,6 +10,7 @@
src: "css" src: "css"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0775"
check_mode: false check_mode: false
- name: Copy logos over - name: Copy logos over
@@ -16,6 +18,7 @@
src: "{{ item }}" src: "{{ item }}"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0644"
loop: loop:
- "webpage_logo.png" - "webpage_logo.png"
- "redhat-ansible-logo.svg" - "redhat-ansible-logo.svg"

View File

@@ -2,6 +2,7 @@
ansible.builtin.template: ansible.builtin.template:
src: report.j2 src: report.j2
dest: "{{ file_path }}/linuxpatch.html" dest: "{{ file_path }}/linuxpatch.html"
mode: "0644"
check_mode: false check_mode: false
- name: Copy CSS over - name: Copy CSS over
@@ -9,6 +10,7 @@
src: "css" src: "css"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0775"
check_mode: false check_mode: false
- name: Copy logo over - name: Copy logo over
@@ -16,6 +18,7 @@
src: "webpage_logo.png" src: "webpage_logo.png"
dest: "{{ file_path }}" dest: "{{ file_path }}"
directory_mode: true directory_mode: true
mode: "0644"
check_mode: false check_mode: false
- name: Display link to Linux patch report - name: Display link to Linux patch report

View File

@@ -12,12 +12,14 @@
ansible.builtin.file: ansible.builtin.file:
path: "{{ doc_root }}/{{ reports_dir }}" path: "{{ doc_root }}/{{ reports_dir }}"
state: directory state: directory
mode: "0775"
check_mode: false check_mode: false
- name: Copy .htaccess - name: Copy .htaccess
ansible.builtin.copy: ansible.builtin.copy:
dest: "{{ doc_root }}/{{ reports_dir }}/.htaccess" dest: "{{ doc_root }}/{{ reports_dir }}/.htaccess"
content: Options +Indexes content: Options +Indexes
mode: "0644"
check_mode: false check_mode: false
- name: Install httpd service - name: Install httpd service

View File

@@ -13,6 +13,7 @@
ansible.builtin.template: ansible.builtin.template:
src: linux_report.j2 src: linux_report.j2
dest: "{{ doc_root }}/index.html" dest: "{{ doc_root }}/index.html"
mode: "0644"
check_mode: false check_mode: false
- name: Copy CSS - name: Copy CSS
@@ -20,6 +21,7 @@
src: "css" src: "css"
dest: "{{ doc_root }}" dest: "{{ doc_root }}"
directory_mode: true directory_mode: true
mode: "0775"
check_mode: false check_mode: false
- name: Copy logos - name: Copy logos
@@ -27,6 +29,7 @@
src: "{{ item }}" src: "{{ item }}"
dest: "{{ doc_root }}" dest: "{{ doc_root }}"
directory_mode: true directory_mode: true
mode: "0775"
loop: loop:
- "webpage_logo.png" - "webpage_logo.png"
- "redhat-ansible-logo.svg" - "redhat-ansible-logo.svg"

View File

@@ -19,13 +19,15 @@
name: "{{ application }}" name: "{{ application }}"
allow_downgrade: true allow_downgrade: true
register: result register: result
notify: Printing to terminal application information
- name: Printing to terminal application information # noqa: no-handler
ansible.builtin.debug:
msg: "The application: {{ application }} was already installed"
when: not result.changed | bool
handlers:
- name: Printing to terminal application information - name: Printing to terminal application information
ansible.builtin.debug: ansible.builtin.debug:
msg: "The application: {{ application }} has been installed" msg: "The application: {{ application }} has been installed"
when: result.changed | bool when: result.changed | bool
- name: Printing to terminal application information
ansible.builtin.debug:
msg: "The application: {{ application }} was already installed"
when: not result.changed | bool

View File

@@ -16,11 +16,14 @@
ansible.builtin.file: ansible.builtin.file:
path: "{{ volume_path }}" path: "{{ volume_path }}"
state: directory state: directory
mode: "0775"
- name: Create index.html - name: Create index.html
ansible.builtin.copy: ansible.builtin.copy:
dest: "{{ volume_path }}/index.html" dest: "{{ volume_path }}/index.html"
content: "{{ message }}" content: "{{ message }}"
mode: "0664"
- name: Run httpd container - name: Run httpd container
containers.podman.podman_container: containers.podman.podman_container:
@@ -30,11 +33,11 @@
volume: volume:
- "./{{ volume_path }}/:/usr/local/apache2/htdocs:z" - "./{{ volume_path }}/:/usr/local/apache2/htdocs:z"
ports: ports:
- "8080:80" - "8081:80"
- name: Check Web Page - name: Check Web Page
ansible.builtin.uri: ansible.builtin.uri:
url: http://127.0.0.1:8080 url: http://127.0.0.1:8081
return_content: true return_content: true
register: web_output register: web_output
changed_when: false changed_when: false

View File

@@ -9,9 +9,10 @@
tasks: tasks:
- name: Randomized startup delay... - name: Randomized startup delay...
ansible.builtin.pause: seconds="{{ 5 | random }}" ansible.builtin.pause:
seconds: "{{ 5 | random }}"
- name: Run SCAP Scan - name: Run SCAP Scan # noqa: no-changed-when - purpose is to run everytime
ansible.builtin.command: "/usr/bin/foreman_scap_client {{ item.id }}" ansible.builtin.command: "/usr/bin/foreman_scap_client {{ item.id }}"
loop: "{{ policy }}" loop: "{{ policy }}"
when: policy_scan == 'all' or item.name in policy_scan when: policy_scan == 'all' or item.name in policy_scan