Skip to content

Commit

Permalink
Merge pull request #42 from brianhartsock/simplify_yamllint
Browse files Browse the repository at this point in the history
Simplified .yamllint; Fixed resulting lint errors
  • Loading branch information
brianhartsock authored Feb 5, 2025
2 parents 7c8c7a8 + 31b19b2 commit 8f1f36c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
skip_list:
- 'yaml'
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish Role to Galaxy

on:
on: # yamllint disable-line rule:truthy
release:
types: [published]

Expand All @@ -14,12 +14,12 @@ jobs:
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.x'

- name: Install Ansible.
run: pip3 install ansible-core

- name: Trigger a new import on Galaxy.
run: >-
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }}
$(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
$(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
repos:
- repo: local
hooks:
Expand Down
51 changes: 23 additions & 28 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
---
# Based on ansible-lint config
extends: default

# Using ansible-lint recommendations https://ansible.readthedocs.io/projects/lint/rules/yaml/#yamllint-configuration
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
comments:
# https://github.com/prettier/prettier/issues/6780
min-spaces-from-content: 1
# https://github.com/adrienverge/yamllint/issues/384
comments-indentation: false
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
# 160 chars was the default used by old E204 rule, but
# you can easily change it or disable in your .yamllint file.
line-length:
max: 160
# We are adding an extra space inside braces as that's how prettier does it
# and we are trying not to fight other linters.
braces:
min-spaces-inside: 0 # yamllint defaults to 0
max-spaces-inside: 1 # yamllint defaults to 0
# key-duplicates:
# forbid-duplicated-merge-keys: true # not enabled by default
octal-values:
forbid-implicit-octal: true # yamllint defaults to false
forbid-explicit-octal: true # yamllint defaults to false
# quoted-strings:
# quote-type: double
# required: only-when-needed

ignore: |
.git
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
avahi_services: []
avahi_replace_wildcards: yes
avahi_replace_wildcards: true
avahi_network_name: '%h'
avahi_use_ipv6: 'no'
avahi_allow_interfaces: "{{ ansible_default_ipv4.interface }}"
Expand Down
9 changes: 5 additions & 4 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
---
galaxy_info:
role_name: avahi
namespace: brianhartsock
author: Brian Hartsock
description: Ansible role for installing and configuring Avahi.
license: MIT

min_ansible_version: "2.4"

platforms:
- name: Ubuntu
versions:
- focal
- jammy
- noble
- focal
- jammy
- noble

galaxy_tags:
- ubuntu
Expand Down
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
dest: /etc/avahi/avahi-daemon.conf
owner: root
group: root
mode: 0644
mode: "0644"
notify:
- Restart Avahi
- name: Install Avahi service definitions
Expand All @@ -20,7 +20,7 @@
dest: /etc/avahi/services/{{ item.name }}.service
owner: root
group: root
mode: 0644
mode: "0644"
vars:
avahi_service_services: '{{ item.services }}'
with_items: '{{ avahi_services }}'
Expand Down

0 comments on commit 8f1f36c

Please sign in to comment.