Introduce ansible-lint

This commit is contained in:
Wojciech Kozlowski 2022-12-18 23:00:28 +01:00
parent 4c503561e4
commit 320832829b
12 changed files with 29 additions and 27 deletions

7
.ansible-lint Normal file
View File

@ -0,0 +1,7 @@
---
skip_list:
- no-handler
- git-latest
- no-changed-when
- meta-no-info
- yaml

View File

@ -1,16 +1,12 @@
ci-requirements:
@python -m pip install --upgrade -r ci-requirements.txt
ansible-lint:
@ansible-lint
ansible-syntax:
@ansible --syntax-check main.yml -i production
yamllint:
@yamllint .
plugins-test:
@python -m pytest -vv --cov plugins/filter --cov-report=term-missing plugins/tests
lint: ansible-lint ansible-syntax yamllint
plugins-lint:
@python -m flake8 plugins
.PHONY: ci-requirements ansible-lint yamllint plugins-test plugins-lint
.PHONY: ansible-lint ansible-syntax yamllint

View File

@ -13,6 +13,7 @@
ansible.builtin.copy:
src: "/etc/skel/"
dest: "{{ services_service_user_home }}"
mode: "preserve"
remote_src: true
when:
services_datasets_user_zfs_home.changed

View File

@ -10,5 +10,6 @@
ansible.builtin.copy:
src: "files/services/setup/system/nameserver/resolv.conf"
dest: "{{ services_root_directory }}/valkyrie-resolv.conf"
mode: 0644
when:
ansible_hostname != "valkyrie"

View File

@ -1,13 +1,10 @@
- name: "motd : set motd"
ansible.builtin.copy:
src: "{{ _system_base_motd_file }}"
src: "{{ item }}"
dest: "/etc/motd"
mode: 0644
when:
system_base_motd_dir is defined and
_system_base_motd_file != ""
loop: "{{ [lookup('ansible.builtin.first_found', _file_path, skip=true)] | flatten }}"
vars:
_file_path:
- "{{ system_base_motd_dir }}/{{ ansible_hostname }}"
_system_base_motd_file: >-
{{ lookup('ansible.builtin.first_found', _file_path, errors='ignore') }}
_file_path: "{{ system_base_motd_dir }}/{{ ansible_hostname }}"
when:
system_base_motd_dir is defined