diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..8b1853d --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,3 @@ +--- +skip_list: + - 'yaml' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aefd7ac..c55d828 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ name: Publish Role to Galaxy -on: +on: # yamllint disable-line rule:truthy release: types: [published] @@ -14,7 +14,7 @@ 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 @@ -22,4 +22,4 @@ jobs: - 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) \ No newline at end of file + $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 724c0fb..096a6d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +--- repos: - repo: local hooks: diff --git a/.yamllint b/.yamllint index 57fb112..468d949 100644 --- a/.yamllint +++ b/.yamllint @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml index 9ec7c94..bbad340 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 }}" diff --git a/meta/main.yml b/meta/main.yml index 24b7088..4b892c5 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index fa13064..a80b28b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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 @@ -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 }}'