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-lint @ansible-lint
ansible-syntax:
@ansible --syntax-check main.yml -i production
yamllint: yamllint:
@yamllint . @yamllint .
plugins-test: lint: ansible-lint ansible-syntax yamllint
@python -m pytest -vv --cov plugins/filter --cov-report=term-missing plugins/tests
plugins-lint: .PHONY: ansible-lint ansible-syntax yamllint
@python -m flake8 plugins
.PHONY: ci-requirements ansible-lint yamllint plugins-test plugins-lint

View File

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

View File

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

View File

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