Skip to content

Commit

Permalink
Enable ansible-lint (#220)
Browse files Browse the repository at this point in the history
* Enable ansible-lint

Related: ansible/ansible-lint#3482

* Update ansible-lint.yml

---------

Co-authored-by: Nilashish Chakraborty <[email protected]>
  • Loading branch information
ssbarnea and NilashishC authored Dec 1, 2023
1 parent 085d0a8 commit 6dbdcd1
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 8 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# .github/workflows/ansible-lint.yml
name: ansible-lint
"on":
pull_request:
branches: ["main", "stable", "release/v*"]
jobs:
build:
name: Ansible Lint # Naming the build is important to use it as a status check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ansible-lint
uses: ansible/ansible-lint@main
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ on:
pull_request_target:
branches: [main]
types:
- labeled
- opened
- reopened
- synchronize
- labeled
- opened
- reopened
- synchronize
workflow_dispatch:

jobs:
Expand Down
21 changes: 21 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
extends: default
ignore: |
.tox

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
comments:
# https://github.com/prettier/prettier/issues/6780
min-spaces-from-content: 1

# https://github.com/adrienverge/yamllint/issues/141
comments-indentation: false
document-start: disable
line-length: disable
truthy:
check-keys: false
4 changes: 3 additions & 1 deletion playbooks/site.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- hosts: localhost
- name: Site playbook
hosts: localhost
gather_facts: true
tasks:
- name: Retrieve a repository from a distant location and make it available locally
Expand All @@ -13,6 +14,7 @@
ansible.builtin.copy:
content: "{{ repository | to_nice_yaml }}"
dest: "{{ repository['path'] }}/details.yaml"
mode: "0600"

- name: Publish the changes
ansible.scm.git_publish:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/key_checking/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ansible.scm.git_retrieve:
origin:
url: [email protected]:ansible-collections/ansible.scm.git
host_key_checking: no
host_key_checking: false
ignore_errors: true
register: repository

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/success/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
no_log: true
register: deleted
vars:
auth: "{{ un64|b64encode }}"
auth: "{{ un64 | b64encode }}"
un64: "x-access-token:{{ lookup('env', 'GITHUB_TOKEN') }}"
2 changes: 1 addition & 1 deletion tests/integration/targets/user_dir/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
register: repository

- name: Verify the repository was created in the directory
assert:
ansible.builtin.assert:
that:
- repository.path.startswith(parent_directory)

Expand Down

0 comments on commit 6dbdcd1

Please sign in to comment.