Skip to content

Commit

Permalink
Merge pull request #1 from sscheib/ft-ansible_lint_github_workflow
Browse files Browse the repository at this point in the history
Ft ansible lint GitHub workflow
  • Loading branch information
sscheib authored Oct 24, 2023
2 parents 44ad316 + ff2151b commit 0bab21d
Show file tree
Hide file tree
Showing 20 changed files with 277 additions and 126 deletions.
29 changes: 29 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
enable_list:
- 'args'
- 'empty-string-compare'
- 'no-log-password'
- 'no-same-owner'
- 'name[prefix]'

kinds:
- yaml: '.ansible-lint'
- yaml: '.github/workflows/ansible-lint.yml'
- yaml: '.pre-commit-config.yaml'
- yaml: '.yamllint'
- yaml: '**/*.{yml,yaml}'

loop_var_prefix: '^(__|{role}_)'
max_block_depth: 20
offline: true
profile: 'production'
skip_action_validation: false
skip_list: []
task_name_prefix: '{stem} | '
use_default_rules: true
var_naming_pattern: '^[a-z_][a-z0-9_]*$'
warn_list:
- 'experimental'
write_list:
- 'none'
...
22 changes: 22 additions & 0 deletions .github/workflows/ansible-galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: 'Publish latest release to Ansible Galaxy'

on:
push:
branches:
- 'main'
workflow_dispatch: {}

jobs:
build:
name: 'Publish to Ansible Galaxy'
runs-on: 'ubuntu-latest'
steps:
- name: 'checkout'
uses: 'actions/checkout@v2'
- name: 'galaxy'
uses: 'robertdebock/galaxy-action@1.2.0'
with:
galaxy_api_key: '${{ secrets.galaxy_api_key }}'
git_branch: 'main'
...
15 changes: 15 additions & 0 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: 'ansible-lint'
on:
pull_request:
branches: ['main']
workflow_dispatch: {}
jobs:
build:
name: 'Ansible Lint'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v4'
- name: 'Run ansible-lint'
uses: 'ansible/ansible-lint@main'
...
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
repos:
- repo: 'https://github.com/ansible/ansible-lint'
rev: 'v6.20.3'
hooks:
- name: 'Ansible-lint'
additional_dependencies:
# https://github.com/pre-commit/pre-commit/issues/1526
# If you want to use specific version of ansible-core or ansible, feel
# free to override `additional_dependencies` in your own hook config
# file.
- 'ansible-core>=2.15'
always_run: true
description: 'This hook runs ansible-lint.'
entry: 'python3 -m ansiblelint -v --force-color'
id: 'ansible-lint'
language: 'python'
# do not pass files to ansible-lint, see:
# https://github.com/ansible/ansible-lint/issues/611
pass_filenames: false
...
50 changes: 31 additions & 19 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,33 +1,45 @@
---
# Based on ansible-lint config
extends: default
extends: 'default'

rules:
braces:
level: 'error'
max-spaces-inside: 1
level: error
brackets:
level: 'error'
max-spaces-inside: 1
level: error
colons:
level: 'error'
max-spaces-after: -1
level: error
commas:
level: 'error'
max-spaces-after: -1
level: error
comments: enable
comments-indentation: enable
document-start: enable
comments: 'enable'
comments-indentation: 'enable'
document-end: 'enable'
document-start: 'enable'
empty-lines:
level: 'error'
max: 3
level: error
hyphens:
level: error
indentation: enable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: enable
empty-values: 'enable'
float-values: 'enable'
hyphens: 'enable'
indentation: 'enable'
key-duplicates: 'enable'
key-ordering: 'disable'
line-length:
max: 120
new-line-at-end-of-file: 'enable'
new-lines:
type: unix
trailing-spaces: enable
truthy: enable
type: 'unix'
octal-values: 'enable'
quoted-strings: 'enable'
trailing-spaces: 'enable'
truthy: 'enable'

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'
- '.ansible.lint'
...
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![ansible-lint](https://github.com/sscheib/ansible-role-rhel_iso_kickstart/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/sscheib/ansible-role-rhel_iso_kickstart/actions/workflows/ansible-lint.ymlo) [![Publish latest release to Ansible Galaxy](https://github.com/sscheib/ansible-role-rhel_iso_kickstart/actions/workflows/ansible-galaxy.yml/badge.svg)](https://github.com/sscheib/ansible-role-rhel_iso_kickstart/actions/workflows/ansible-galaxy.yml)

rhel_iso_kickstart
=========

Expand Down
1 change: 1 addition & 0 deletions collections/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
collections:
- name: 'ansible.posix'
version: '>=1.5.4'
...
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ _def_post_sections:

- name: 'Autorelabel'
template: 'post__autorelabel.j2'
...
4 changes: 3 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ galaxy_info:
role_name: 'rhel_iso_kickstart'
namespace: 'sscheib'
author: 'Steffen Scheib'
description: 'Downloads a RHEL ISO from the Red Hat Customer Portal and optionally implants a kickstart file into a custom ISO'
description: >-
Downloads a RHEL ISO from the Red Hat Customer Portal and optionally implants a kickstart file into a custom ISO
issue_tracker_url: 'https://github.com/sscheib/ansible-role-rhel_iso_kickstart/issues'
license: 'GPL-2.0-or-later'
min_ansible_version: '2.12'
Expand All @@ -15,3 +16,4 @@ galaxy_info:
- 'rhel'
- 'kickstart'
dependencies: []
...
Loading

0 comments on commit 0bab21d

Please sign in to comment.