Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified .yamllint; Fixed resulting lint errors #42

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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