From d50cfa1c57867c8e4c1679361d8e1a49cd5e08a1 Mon Sep 17 00:00:00 2001 From: Chris Croome <chris@webarchitects.co.uk> Date: Tue, 21 Jan 2025 22:06:24 +0000 Subject: [PATCH] fixes --- .gitlab-ci.yml | 1 + .yamllint | 30 ++++++++++++++++++++++++++++++ meta/argument_specs.yml | 8 ++++++++ molecule/default/molecule.yml | 5 ++--- molecule/default/verify.yml | 4 ++-- tasks/pkg.yml | 8 ++++---- 6 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 .yamllint diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae36b76..8cfd104 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ # # You should have received a copy of the GNU General Public License along with the Webarchitects Valkey Ansible role. If not, see <https://www.gnu.org/licenses/>. --- +variables: ANSIBLE_ANY_ERRORS_FATAL: "1" ANSIBLE_CALLBACK_RESULT_FORMAT: "yaml" ANSIBLE_DIFF_ALWAYS: "1" diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..9a4611f --- /dev/null +++ b/.yamllint @@ -0,0 +1,30 @@ +# Copyright 2025 Chris Croome +# +# This file is part of the Webarchitects Valkey Ansible role. +# +# The Webarchitects Valkey Ansible role is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +# +# The Webarchitects Valkey Ansible role is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with the Webarchitects Valkey Ansible role. If not, see <https://www.gnu.org/licenses/>. +--- +extends: default +yaml-files: + - '*.yaml' + - '*.yml' +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable + comments-indentation: disable + comments: + min-spaces-from-content: 1 + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true +# vim: syntax=yaml +... diff --git a/meta/argument_specs.yml b/meta/argument_specs.yml index d0c7299..daf1115 100644 --- a/meta/argument_specs.yml +++ b/meta/argument_specs.yml @@ -18,6 +18,10 @@ argument_specs: type: bool required: true description: Run the tasks in this role. + valkey_apt_backports: + type: str + required: true + description: String that will be present in the apt cache policy when backports are enabled. valkey_pkgs: type: list elements: dict @@ -44,4 +48,8 @@ argument_specs: type: list required: false description: A list of deb packages that should be present from backports. + valkey_verify: + type: bool + required: true + description: Use the argument specification to verify the variables that start with valkey_. ... diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 888bb52..abb2ab6 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -8,7 +8,7 @@ # # You should have received a copy of the GNU General Public License along with the Webarchitects Valkey Ansible role. If not, see <https://www.gnu.org/licenses/>. --- -dependency: +dependency: name: galaxy platforms: - name: instance @@ -18,7 +18,7 @@ provisioner: defaults: ansible_managed: Ansible managed # host_vars: - # instance: + # instance: # ansible_user: ansible options: D: true @@ -28,4 +28,3 @@ verifier: # instance: # ansible_user: ansible ... - diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index aa0b711..a79810b 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -17,11 +17,11 @@ vars: ansible_python_interpreter: /usr/bin/python3 tasks: - + - name: Gather service facts ansible.builtin.service_facts: register: molecule_service_facts - + - name: Debug valkey service status ansible.builtin.debug: msg: "{{ molecule_service_facts | community.general.json_query(molecule_service_jpq) }}" diff --git a/tasks/pkg.yml b/tasks/pkg.yml index 6aeff6b..f4aaf6b 100644 --- a/tasks/pkg.yml +++ b/tasks/pkg.yml @@ -81,10 +81,10 @@ - (valkey_pkgs | community.general.json_query(valkey_jpq.pkgs_present_backports)) | type_debug == "list" quiet: "{% if ansible_check_mode or ansible_verbosity >= 1 %}false{% else %}true{% endif %}" - - name: Check that backports are available when backports packages are specified - ansible.builtin.assert: - that: - - valkey_apt_backports in valkey_apt_cache_policy.stdout + - name: Check that backports are available when backports packages are specified + ansible.builtin.assert: + that: + - valkey_apt_backports in valkey_apt_cache_policy.stdout quiet: "{% if ansible_check_mode or ansible_verbosity >= 1 %}false{% else %}true{% endif %}" when: valkey_pkgs | community.general.json_query(valkey_jpq.pkgs_present_backports) != [] -- GitLab