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

@ -32,7 +32,7 @@
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}.j2"
src: "./systemd/{{ item }}.j2"
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
mode: 0600
loop:

View File

@ -12,14 +12,14 @@
- name: "configure postgres password"
ansible.builtin.template:
src: "./postgres/database.password.j2"
src: "./postgres/database.password.j2"
dest: "{{ services_service_user_home }}/.config/{{ services_service_user_name }}/database.password"
mode: 0600
register: services_deploy_database_password_file
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}.j2"
src: "./systemd/{{ item }}.j2"
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
mode: 0600
loop:

View File

@ -12,7 +12,7 @@
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}.j2"
src: "./systemd/{{ item }}.j2"
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
mode: 0600
loop:

View File

@ -30,7 +30,7 @@
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}.j2"
src: "./systemd/{{ item }}.j2"
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
mode: 0600
loop:
@ -55,7 +55,7 @@
register: services_deploy_lrproxy_rsync_certificates_timer
- 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:
creates: "{{ services_service_user_home }}/.config/{{ services_service_user_name }}/dhparam.pem"
register: services_deploy_lrproxy_dhparam

View File

@ -12,7 +12,7 @@
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}.j2"
src: "./systemd/{{ item }}.j2"
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
mode: 0600
loop:

View File

@ -30,7 +30,7 @@
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}.j2"
src: "./systemd/{{ item }}.j2"
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
mode: 0600
loop:
@ -55,7 +55,7 @@
register: services_deploy_rproxy_certbot_timer
- 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:
creates: "{{ services_service_user_home }}/.config/{{ services_service_user_name }}/dhparam.pem"
register: services_deploy_rproxy_dhparam

View File

@ -34,7 +34,7 @@
- name: "configure systemd service"
ansible.builtin.template:
src: "./systemd/{{ item }}.j2"
src: "./systemd/{{ item }}.j2"
dest: "{{ services_service_user_home }}/.config/systemd/user/{{ item }}"
mode: 0600
loop:

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