Skip to content

Commit

Permalink
Merge pull request #33 from ganto/feature/yamllint
Browse files Browse the repository at this point in the history
Fix yamllint
  • Loading branch information
ganto authored Jun 17, 2024
2 parents 4674e56 + 2823fc9 commit 3a9c559
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 50 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
warn_list:
- name[template]
- yaml[line-length]
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ jobs:
python-version: '3.x'

- name: Install test dependencies.
run: pip3 install yamllint ansible-lint[community]
run: pip3 install yamllint ansible-lint

- name: Install Ansible collections
run: ansible-galaxy install -r molecule/docker/collections.yml

- name: Add checkout to Ansible role path.
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ jobs:
run: pip3 install ansible-base

- 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)
run: >
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }}
| cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
40 changes: 13 additions & 27 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
---
# Based on ansible-lint config
extends: default

rules:
truthy: disable
# ansible-lint compatibility
# https://ansible.readthedocs.io/projects/lint/rules/yaml/#yamllint-configuration
braces:
min-spaces-inside: 0
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:
min-spaces-from-content: 1
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
line-length:
max: 120
level: warning
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
4 changes: 4 additions & 0 deletions molecule/docker/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
collections:
- name: community.docker
- name: community.general
5 changes: 4 additions & 1 deletion molecule/docker/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

dependency:
name: galaxy
enabled: False
options:
requirements-file: collections.yml
driver:
name: docker
platforms:
Expand All @@ -25,6 +26,8 @@ provisioner:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
scenario:
test_sequence:
- dependency
- destroy
- syntax
- create
- prepare
Expand Down
2 changes: 1 addition & 1 deletion molecule/docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible
ansible-core==2.16.7
docker
molecule
molecule-plugins[docker]
4 changes: 4 additions & 0 deletions molecule/podman/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
collections:
- name: community.general
- name: containers.podman
4 changes: 0 additions & 4 deletions molecule/podman/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,5 @@
copr_reposync_distributions:
- '{{ "fedora" if ansible_distribution == "Fedora" else "epel" }}'

copr_reposync_packages:
- '{{ ansible_pkg_mgr }}-utils'
- 'createrepo_c'

roles:
- role: ganto.copr_reposync
5 changes: 4 additions & 1 deletion molecule/podman/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

dependency:
name: galaxy
enabled: False
options:
requirements-file: collections.yml
driver:
name: podman
platforms:
Expand All @@ -24,6 +25,8 @@ provisioner:
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
scenario:
test_sequence:
- dependency
- destroy
- syntax
- create
- prepare
Expand Down
2 changes: 1 addition & 1 deletion molecule/podman/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ansible
ansible-core==2.16.7
molecule
molecule-plugins[podman]
2 changes: 1 addition & 1 deletion molecule/podman/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
url: 'http://localhost/ganto/jo/ganto-jo-{{ "fedora" if ansible_distribution == "Fedora"
else "epel" }}.repo'
dest: '/etc/yum.repos.d/_copr-mirror_ganto-jo.repo'
mode: 0644
mode: '0644'

- name: Install package from COPR repository mirror
ansible.builtin.package:
Expand Down
12 changes: 6 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,29 @@
ansible.builtin.file:
path: '{{ copr_reposync_path }}'
state: directory
mode: 0755
mode: '0755'

- name: Repository directory and permissions
ansible.builtin.file:
path: '{{ copr_reposync_repo_path }}'
state: directory
mode: 0755
mode: '0755'
owner: '{{ copr_reposync_owner }}'
group: '{{ copr_reposync_owner }}'

- name: Reposync systemd service unit
ansible.builtin.template:
src: [email protected]
dest: /etc/systemd/system/[email protected]
mode: 0644
mode: '0644'
owner: root
group: root

- name: Reposync systemd timer unit
ansible.builtin.template:
src: [email protected]
dest: /etc/systemd/system/[email protected]
mode: 0644
mode: '0644'
owner: root
group: root
when: copr_reposync_timer | bool
Expand All @@ -75,7 +75,7 @@
ansible.builtin.get_url:
url: '{{ copr_reposync_gpg_url }}'
dest: '{{ copr_reposync_repo_path }}/'
mode: 0644
mode: '0644'
when:
- copr_reposync_gpg | bool
- copr_reposync_repos | difference(copr_reposync_remove_repos) | list | length > 0
Expand All @@ -86,7 +86,7 @@
ansible.builtin.template:
src: mirror.repo.j2
dest: '{{ copr_reposync_repo_path }}/{{ copr_reposync_name | replace("/", "-") }}-{{ item }}.repo'
mode: 0644
mode: '0644'
when:
- copr_reposync_repofile | bool
- copr_reposync_repos | difference(copr_reposync_remove_repos) | list | length > 0
Expand Down
12 changes: 6 additions & 6 deletions tasks/reposync_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

- name: '{{ copr_reposync_include_repo }} - Create systemd service drop-in directory'

Check warning on line 9 in tasks/reposync_service.yml

View workflow job for this annotation

GitHub Actions / Lint

name[template]

Jinja templates should only be at the end of 'name'
ansible.builtin.file:
path: '/etc/systemd/system/{{ copr_reposync_fact_unit }}.service.d'
state: directory
mode: 0755
owner: root
group: root
path: '/etc/systemd/system/{{ copr_reposync_fact_unit }}.service.d'
state: directory
mode: '0755'
owner: root
group: root

- name: '{{ copr_reposync_include_repo }} - Create systemd service configuration'
ansible.builtin.template:
src: override.conf.j2
dest: '/etc/systemd/system/{{ copr_reposync_fact_unit }}.service.d/override.conf'
mode: 0644
mode: '0644'
owner: root
group: root
register: copr_reposync_register_service
Expand Down

0 comments on commit 3a9c559

Please sign in to comment.