fix: Linting.

This commit is contained in:
Laur Ivan 2023-09-21 15:39:23 +02:00
parent 4ea9fd1142
commit 28c32a767f
9 changed files with 12 additions and 68 deletions

View File

@ -1,10 +1,12 @@
--- ---
exclude_paths: exclude_paths:
- .cache/
- ./molecule - ./molecule
- ./.travis.yml - ./.travis.yml
- ./.github - ./.github
parseable: true parseable: true
skip_list: skip_list:
- '204' - '204'
- 'no-handler'
use_default_rules: true use_default_rules: true
verbosity: 1 verbosity: 1

View File

@ -33,7 +33,7 @@ unifi_config_path: "{{ unifi_root_path }}/conf/unifi-controller"
unifi_skeleton_paths: unifi_skeleton_paths:
- "{{ unifi_config_path }}" - "{{ unifi_config_path }}"
# Add more templates to be copied into the config # Add more templates to be copied into the config
unifi_configuration_files: unifi_configuration_files:
- "docker-compose.yml" - "docker-compose.yml"
- "env.unifi-controller.conf" - "env.unifi-controller.conf"

View File

@ -9,7 +9,7 @@
- name: "UNIFI-CONTROLLER | Check if the docker-compose file exists." - name: "UNIFI-CONTROLLER | Check if the docker-compose file exists."
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ unifi_config_path | expanduser | realpath }}/docker-compose.yml" path: "{{ unifi_config_path | expanduser | realpath }}/docker-compose.yml"
register: "docker_compose_file" register: "docker_compose_file"
- name: "UNIFI-CONTROLLER | Remove docker-compose." - name: "UNIFI-CONTROLLER | Remove docker-compose."

View File

@ -21,7 +21,9 @@
when: "not docker_sock_stat.stat.exists" when: "not docker_sock_stat.stat.exists"
- name: "UNIFI-CONTROLLER | Update apt cache." - name: "UNIFI-CONTROLLER | Update apt cache."
ansible.builtin.apt: update_cache=yes cache_valid_time=600 ansible.builtin.apt:
update_cache: yes
cache_valid_time: 600
when: "ansible_os_family == 'Debian'" when: "ansible_os_family == 'Debian'"
- name: "UNIFI-CONTROLLER | Install python requests" - name: "UNIFI-CONTROLLER | Install python requests"

View File

@ -1,4 +1,4 @@
--- ---
roles: roles:
- "geerlingguy.docker" - name: "geerlingguy.docker"
collections: [] collections: []

View File

@ -1,59 +0,0 @@
---
# This is an example playbook to execute goss tests.
# Tests need distributed to the appropriate ansible host/groups
# prior to execution by `goss validate`.
- name: Verify unifi-controller
hosts:
- "unifi-controller"
become: true
vars:
goss_version: "v0.3.16"
goss_arch: "amd64"
goss_dst: "/usr/local/bin/goss"
goss_sha256sum: "827e354b48f93bce933f5efcd1f00dc82569c42a179cf2d384b040d8a80bfbfb"
goss_url: "https://github.com/aelsabbahy/goss/releases/download/{{ goss_version }}/goss-linux-{{ goss_arch }}"
goss_test_directory:" /tmp"
goss_format: "documentation"
vars_files:
- ../../defaults/main.yml
tasks:
- name: "UNIFI-CONTROLLER | Download and install Goss"
get_url:
url: "{{ goss_url }}"
dest: "{{ goss_dst }}"
checksum: "sha256:{{ goss_sha256sum }}"
mode: 0755
register: "download_goss"
until: "download_goss is succeeded"
retries: 3
- name: "UNIFI-CONTROLLER | Copy Goss tests to remote"
template:
src: "{{ item }}"
dest: "{{ goss_test_directory }}/{{ item | basename }}"
with_fileglob:
- "tests/test_*.yml"
- name: "UNIFI-CONTROLLER | Register test files"
shell: "ls {{ goss_test_directory }}/test_*.yml"
register: "test_files"
- name: "UNIFI-CONTROLLER | Execute Goss tests"
command: "{{ goss_dst }} -g {{ item }} validate --format {{ goss_format }}"
register: "test_results"
with_items: "{{ test_files.stdout_lines }}"
ignore_errors: true
- name: "UNIFI-CONTROLLER | Display details about the Goss results"
debug:
msg: "{{ item.stdout_lines }}"
with_items: "{{ test_results.results }}"
- name: "UNIFI-CONTROLLER | Fail when tests fail"
fail:
msg: "Goss failed to validate"
when: item.rc != 0
with_items: "{{ test_results.results }}"

View File

@ -15,10 +15,9 @@
- name: "UNIFI-CONTROLLER | Write configuration files" - name: "UNIFI-CONTROLLER | Write configuration files"
ansible.builtin.template: ansible.builtin.template:
src: "{{ item }}.j2" src: "{{ item }}.j2"
dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item }}" dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item }}"
mode: '0640' mode: '0640'
with_items: with_items:
- "{{ unifi_configuration_files }}" - "{{ unifi_configuration_files }}"
tags: tags:
- unifi_configure - unifi_configure

View File

@ -1,11 +1,11 @@
--- ---
- name: "UNIFI-CONTROLLER | Configure" - name: "UNIFI-CONTROLLER | Configure"
import_tasks: config.yml ansible.builtin.import_tasks: config.yml
tags: tags:
- unifi_configure - unifi_configure
- name: "UNIFI-CONTROLLER | Install" - name: "UNIFI-CONTROLLER | Install"
import_tasks: install.yml ansible.builtin.import_tasks: install.yml
tags: tags:
- unifi_install - unifi_install

View File

@ -3,5 +3,5 @@ ansible==8.3.0
molecule==6.0.2 molecule==6.0.2
docker==6.1.3 docker==6.1.3
molecule-docker==2.1.0 molecule-docker==2.1.0
ansible-lint==6.19.0 ansible-lint==6.20.0
yamllint==1.32.0 yamllint==1.32.0