diff --git a/.ansible-lint b/.ansible-lint index 355eeac..1dd6555 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,10 +1,12 @@ --- exclude_paths: + - .cache/ - ./molecule - ./.travis.yml - ./.github parseable: true skip_list: - '204' + - 'no-handler' use_default_rules: true verbosity: 1 diff --git a/defaults/main.yml b/defaults/main.yml index 74a053f..1a34060 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -33,7 +33,7 @@ unifi_config_path: "{{ unifi_root_path }}/conf/unifi-controller" unifi_skeleton_paths: - "{{ unifi_config_path }}" -# Add more templates to be copied into the config +# Add more templates to be copied into the config unifi_configuration_files: - "docker-compose.yml" - "env.unifi-controller.conf" diff --git a/molecule/default/cleanup.yml b/molecule/default/cleanup.yml index 184e601..daf6d89 100644 --- a/molecule/default/cleanup.yml +++ b/molecule/default/cleanup.yml @@ -9,7 +9,7 @@ - name: "UNIFI-CONTROLLER | Check if the docker-compose file exists." 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" - name: "UNIFI-CONTROLLER | Remove docker-compose." diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index b6393d5..fb7d404 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -21,7 +21,9 @@ when: "not docker_sock_stat.stat.exists" - 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'" - name: "UNIFI-CONTROLLER | Install python requests" diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml index f51f987..df6ed07 100644 --- a/molecule/default/requirements.yml +++ b/molecule/default/requirements.yml @@ -1,4 +1,4 @@ --- roles: - - "geerlingguy.docker" + - name: "geerlingguy.docker" collections: [] diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml deleted file mode 100644 index 1024662..0000000 --- a/molecule/default/verify.yml +++ /dev/null @@ -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 }}" diff --git a/tasks/config.yml b/tasks/config.yml index 1cf55e8..76b6f1d 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -15,10 +15,9 @@ - name: "UNIFI-CONTROLLER | Write configuration files" ansible.builtin.template: src: "{{ item }}.j2" - dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item }}" + dest: "{{ unifi_config_path | expanduser | realpath }}/{{ item }}" mode: '0640' with_items: - "{{ unifi_configuration_files }}" tags: - unifi_configure - \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index f6449c3..6afc881 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,11 +1,11 @@ --- - name: "UNIFI-CONTROLLER | Configure" - import_tasks: config.yml + ansible.builtin.import_tasks: config.yml tags: - unifi_configure - name: "UNIFI-CONTROLLER | Install" - import_tasks: install.yml + ansible.builtin.import_tasks: install.yml tags: - unifi_install diff --git a/test-requirements.txt b/test-requirements.txt index a445dc6..31bf1f2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,5 +3,5 @@ ansible==8.3.0 molecule==6.0.2 docker==6.1.3 molecule-docker==2.1.0 -ansible-lint==6.19.0 +ansible-lint==6.20.0 yamllint==1.32.0 \ No newline at end of file