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

@ -55,7 +55,7 @@
register: services_deploy_lrproxy_rsync_certificates_timer register: services_deploy_lrproxy_rsync_certificates_timer
- name: "generate diffie hellman ephemeral parameters" - name: "generate diffie hellman ephemeral parameters"
ansible.builtin.command: "openssl dhparam --out /{{ services_service_user_home }}/.config/{{ services_service_user_name}}/dhparam.pem 4096" ansible.builtin.command: "openssl dhparam --out /{{ services_service_user_home }}/.config/{{ services_service_user_name }}/dhparam.pem 4096"
args: args:
creates: "{{ services_service_user_home }}/.config/{{ services_service_user_name }}/dhparam.pem" creates: "{{ services_service_user_home }}/.config/{{ services_service_user_name }}/dhparam.pem"
register: services_deploy_lrproxy_dhparam register: services_deploy_lrproxy_dhparam

View File

@ -55,7 +55,7 @@
register: services_deploy_rproxy_certbot_timer register: services_deploy_rproxy_certbot_timer
- name: "generate diffie hellman ephemeral parameters" - name: "generate diffie hellman ephemeral parameters"
ansible.builtin.command: "openssl dhparam --out /{{ services_service_user_home }}/.config/{{ services_service_user_name}}/dhparam.pem 4096" ansible.builtin.command: "openssl dhparam --out /{{ services_service_user_home }}/.config/{{ services_service_user_name }}/dhparam.pem 4096"
args: args:
creates: "{{ services_service_user_home }}/.config/{{ services_service_user_name }}/dhparam.pem" creates: "{{ services_service_user_home }}/.config/{{ services_service_user_name }}/dhparam.pem"
register: services_deploy_rproxy_dhparam register: services_deploy_rproxy_dhparam

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') }}