Add Ansible Lint action and fix lint errors

This commit is contained in:
bluikko 2020-12-12 15:16:44 +07:00 committed by GitHub
parent c41119f58a
commit 534c1f8a48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 11 deletions

31
.github/workflows/ansible-lint.yml vendored Normal file
View File

@ -0,0 +1,31 @@
---
# https://github.com/ansible/ansible-lint-action
name: Ansible Lint
on:
push:
paths:
- '**.yml'
- '**.yaml'
jobs:
ansible-lint:
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Add installed collections in Ansible configuration
run: |
echo '[defaults]' > ansible.cfg
echo 'collections_paths = ./collections' >> ansible.cfg
- name: Install requirements
run: ansible-galaxy collection install -r ansible/playbooks/requirements.yml -p collections
- name: Ansible Lint
uses: ansible/ansible-lint-action@master
with:
args: "--exclude .github"

View File

@ -20,7 +20,7 @@
fail_msg: "We are missing group information or ipa admin password" fail_msg: "We are missing group information or ipa admin password"
- name: "Creating Mandatory Groups" - name: "Creating Mandatory Groups"
ipagroup: freeipa.ansible_freeipa.ipagroup:
ipaadmin_password: "{{ ipaadmin_password }}" ipaadmin_password: "{{ ipaadmin_password }}"
name: "{{ ipaGroup }}" name: "{{ ipaGroup }}"
description: "{{ ipaDescription }}" description: "{{ ipaDescription }}"

View File

@ -23,7 +23,7 @@
fail_msg: "We are missing user information or ipa admin password" fail_msg: "We are missing user information or ipa admin password"
- name: "Creating User Account" - name: "Creating User Account"
ipauser: freeipa.ansible_freeipa.ipauser:
ipaadmin_password: "{{ ipaadmin_password }}" ipaadmin_password: "{{ ipaadmin_password }}"
name: "{{ ipaName }}" name: "{{ ipaName }}"
first: "{{ ipaFirst }}" first: "{{ ipaFirst }}"

View File

@ -1,7 +1,7 @@
--- ---
# Creates the first set of groups for the IdM Infrastructure # Creates the first set of groups for the IdM Infrastructure
- name: "Creating Mandatory Groups" - name: "Creating Mandatory Groups"
ipagroup: freeipa.ansible_freeipa.ipagroup:
ipaadmin_password: "{{ ipaadmin_password }}" ipaadmin_password: "{{ ipaadmin_password }}"
name: "{{ item.group }}" name: "{{ item.group }}"
description: "{{ item.description }}" description: "{{ item.description }}"

View File

@ -2,7 +2,7 @@
# Currently only one SUDO role should be created, and that is for the # Currently only one SUDO role should be created, and that is for the
# rocky linux admins # rocky linux admins
- name: "Creating SUDO Role for Rocky Admins" - name: "Creating SUDO Role for Rocky Admins"
ipasudorule: freeipa.ansible_freeipa.ipasudorule:
ipaadmin_password: "{{ ipaadmin_password }}" ipaadmin_password: "{{ ipaadmin_password }}"
name: All_RockyAdmins name: All_RockyAdmins
description: Rocky Linux infrastructure and operations sudo access description: Rocky Linux infrastructure and operations sudo access

View File

@ -3,7 +3,7 @@
# should create both regular and admin accounts for separation of # should create both regular and admin accounts for separation of
# privilege. # privilege.
- name: "Creating Initial Accounts" - name: "Creating Initial Accounts"
ipauser: freeipa.ansible_freeipa.ipauser:
ipaadmin_password: "{{ ipaadmin_password }}" ipaadmin_password: "{{ ipaadmin_password }}"
name: "{{ item.name }}" name: "{{ item.name }}"
first: "{{ item.first }}" first: "{{ item.first }}"

View File

@ -20,8 +20,9 @@
tasks: tasks:
- name: Check for CPU Virtualization - name: Check for CPU Virtualization
shell: "lscpu | grep -i virtualization" shell: "set -o pipefail; lscpu | grep -i virtualization"
register: result register: result
changed_when: false
failed_when: "result.rc != 0" failed_when: "result.rc != 0"
# Install KVM packages # Install KVM packages
@ -43,8 +44,9 @@
enabled: true enabled: true
- name: Verify KVM module is loaded - name: Verify KVM module is loaded
shell: "lsmod | grep -i kvm" shell: "set -o pipefail; lsmod | grep -i kvm"
register: result register: result
changed_when: false
failed_when: "result.rc != 0" failed_when: "result.rc != 0"
post_tasks: post_tasks:

View File

@ -16,7 +16,7 @@
fail_msg: "We are missing ipa admin password" fail_msg: "We are missing ipa admin password"
- name: "Create Reverse Domains" - name: "Create Reverse Domains"
ipadnszone: freeipa.ansible_freeipa.ipadnszone:
ipaadmin_password: '{{ ipaadmin_password }}' ipaadmin_password: '{{ ipaadmin_password }}'
name: '{{ item }}' name: '{{ item }}'
with_items: '{{ rdns }}' with_items: '{{ rdns }}'

View File

@ -1,3 +1,4 @@
--- ---
- src: freeipa.ansible_freeipa collections:
- src: community.general - freeipa.ansible_freeipa
- community.general

View File

@ -57,6 +57,6 @@
group: root group: root
- name: "Turn on reverse zone syncing" - name: "Turn on reverse zone syncing"
ipadnsconfig: freeipa.ansible_freeipa.ipadnsconfig:
ipaadmin_password: '{{ ipaadmin_password }}' ipaadmin_password: '{{ ipaadmin_password }}'
allow_sync_ptr: true allow_sync_ptr: true