Skip to content

Commit e9326ff

Browse files
authored
Add ansible lint action, fixes #346 (#351)
* Add Ansible lint action * Exclude molecule base path * Remove incompatible .yamllint ansible-lint gives the following error and stops: "Found incompatible custom yamllint configuration (.yamllint), please either remove the file or edit it to comply with: ..." * Fix linter issues * Tune workflow
1 parent 32a1f4c commit e9326ff

File tree

11 files changed

+37
-24
lines changed

11 files changed

+37
-24
lines changed

.ansible-lint

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ skip_list:
77
- jinja
88

99
exclude_paths:
10+
- meta/main.yml # https://github.com/ansible/ansible-lint/issues/4387
11+
- molecule
1012
- molecule/_tests/
1113
- examples/
1214
- tests/

.github/workflows/ansible-lint.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Ansible Lint
3+
on:
4+
push:
5+
tags_ignore:
6+
- '*'
7+
pull_request:
8+
jobs:
9+
run:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Run ansible-lint
15+
uses: ansible/ansible-lint@main
16+
with:
17+
requirements_file: molecule/requirements.yml

.yamllint

Lines changed: 0 additions & 9 deletions
This file was deleted.

defaults/main.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# ---------------------------------------------------------------------------
77

88
# Package variables
9-
vault_version: "{{ lookup('env', 'VAULT_VERSION') | default('1.5.5', true) }}{{ '+prem' if vault_enterprise_premium else '' }}{{ '.hsm' if vault_enterprise_premium_hsm else '' }}"
9+
vault_version_suffix: "{{ '+prem' if vault_enterprise_premium else '' }}{{ '.hsm' if vault_enterprise_premium_hsm else '' }}"
10+
vault_version: "{{ lookup('env', 'VAULT_VERSION') | default('1.5.5', true) }}{{ vault_version_suffix }}"
1011
vault_architecture_map:
1112
# this first entry seems... redundant (but it's required for reasons)
1213
amd64: amd64
@@ -126,7 +127,8 @@ vault_backend_gcs: vault_backend_gcs.j2
126127
vault_cluster_disable: false
127128
vault_cluster_address: "{{ hostvars[inventory_hostname]['ansible_' + vault_iface]['ipv4']['address'] }}:{{ (vault_port | int) + 1 }}"
128129
vault_cluster_addr: "{{ vault_protocol }}://{{ vault_cluster_address }}"
129-
vault_api_addr: "{{ vault_protocol }}://{{ vault_redirect_address | default(hostvars[inventory_hostname]['ansible_' + vault_iface]['ipv4']['address']) }}:{{ vault_port }}"
130+
vault_api_addr: "{{ vault_protocol }}://{{ vault_redirect_address |
131+
default(hostvars[inventory_hostname]['ansible_' + vault_iface]['ipv4']['address']) }}:{{ vault_port }}"
130132
vault_disable_api_health_check: false
131133

132134
vault_max_lease_ttl: "768h"
@@ -213,7 +215,8 @@ vault_raft_cluster_members: |
213215
{
214216
"peer": "{{ server }}",
215217
"api_addr": "{{ hostvars[server]['vault_api_addr'] |
216-
default(vault_protocol + '://' + hostvars[server]['ansible_' + hostvars[server]['ansible_default_ipv4']['interface']]['ipv4']['address'] + ':' + (vault_port|string)) }}"
218+
default(vault_protocol + '://' +
219+
hostvars[server]['ansible_' + hostvars[server]['ansible_default_ipv4']['interface']]['ipv4']['address'] + ':' + (vault_port|string)) }}"
217220
},
218221
{% endfor %}
219222
]

tasks/backend_tls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
state: directory
99
owner: "{{ vault_user }}"
1010
group: "{{ vault_group }}"
11-
mode: 0700
11+
mode: "0700"
1212
with_items:
1313
- "{{ vault_backend_tls_certs_path }}"
1414
- "{{ vault_backend_tls_private_path }}"

tasks/install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
dest: "{{ role_path }}/files/{{ vault_pkg }}"
3636
checksum: "sha256:{{ (lookup('url', vault_checksum_file_url, wantlist=true) | select('match', '.*' + vault_pkg + '$') | first).split()[0] }}"
3737
timeout: "42"
38-
mode: 0644
38+
mode: "0644"
3939
become: "{{ vault_privileged_install }}"
4040
run_once: true
4141
tags: installation

tasks/install_enterprise.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
dest: "{{ role_path }}/files/{{ vault_enterprise_pkg }}"
4545
checksum: sha256:{{ vault_sha256.stdout }}
4646
timeout: 42
47-
mode: 0644
47+
mode: "0644"
4848
become: false
4949
run_once: true
5050
tags: installation

tasks/install_remote.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
file:
1515
path: /tmp/vault
1616
state: directory
17-
mode: 0750
17+
mode: "0750"
1818

1919
- name: Check Vault package file
2020
stat:
@@ -28,7 +28,7 @@
2828
dest: "/tmp/vault/{{ vault_pkg }}"
2929
checksum: "sha256:{{ (lookup('url', vault_checksum_file_url, wantlist=true) | select('match', '.*' + vault_pkg + '$') | first).split()[0] }}"
3030
timeout: "42"
31-
mode: 0644
31+
mode: "0644"
3232
tags: installation
3333
when: not vault_package.stat.exists | bool
3434

tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
dest: /etc/logrotate.d/vault
127127
owner: root
128128
group: root
129-
mode: 0644
129+
mode: "0644"
130130
when: vault_enable_logrotate | bool
131131

132132
- name: TLS configuration
@@ -342,7 +342,7 @@
342342
owner: "{{ vault_user }}"
343343
group: "{{ vault_group }}"
344344
create: true
345-
mode: 0600
345+
mode: "0600"
346346
when:
347347
- not vault_dotfile_disable
348348
- ansible_os_family != 'Windows'
@@ -356,7 +356,7 @@
356356
owner: "{{ vault_user }}"
357357
group: "{{ vault_group }}"
358358
create: true
359-
mode: 0600
359+
mode: "0600"
360360
when:
361361
- not vault_dotfile_disable
362362
- not vault_tls_disable | bool

tasks/plugins/acme.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
file:
2424
path: "{{ (vault_plugin_acme_install == 'local') | ternary(vault_plugins_src_dir_local, vault_plugins_src_dir_remote) }}/acme"
2525
state: directory
26-
mode: 0755
26+
mode: "0755"
2727
owner: "{{ (vault_plugin_acme_install == 'local') | ternary(omit, vault_user) }}"
2828
group: "{{ (vault_plugin_acme_install == 'local') | ternary(omit, vault_group) }}"
2929
register: __vault_plugin_acme_zip_dir
@@ -34,7 +34,7 @@
3434
url: "{{ vault_plugin_acme_release_url }}/{{ vault_plugin_acme_zip }}"
3535
dest: "{{ __vault_plugin_acme_zip_dir.path }}"
3636
checksum: "sha256:{{ vault_plugin_acme_zip_sha256sum }}"
37-
mode: 0644
37+
mode: "0644"
3838
register: __vault_plugin_acme_zip_file
3939
run_once: "{{ (vault_plugin_acme_install == 'local') }}"
4040

@@ -43,7 +43,7 @@
4343
remote_src: "{{ (vault_plugin_acme_install == 'remote') }}"
4444
src: "{{ __vault_plugin_acme_zip_file.dest }}"
4545
dest: "{{ __vault_plugin_acme_zip_dir.path }}"
46-
mode: 0644
46+
mode: "0644"
4747
run_once: "{{ (vault_plugin_acme_install == 'local') }}"
4848

4949
- name: Install acme vault plugin

0 commit comments

Comments
 (0)