From 3e5e68da965b204bd911e168b258557d11ca8a6c Mon Sep 17 00:00:00 2001 From: alexanderbazhenoff Date: Sat, 23 Mar 2024 18:59:31 +0300 Subject: [PATCH] lint changes --- .ansible-lint | 2 +- .github/workflows/mega_linter.yml | 37 ++++++++++ .yamllint | 4 +- LICENSE | 37 ++++++---- galaxy.yml | 2 +- roles/.yamllint | 4 +- roles/bareos/.ansible-lint | 2 +- roles/bareos/.yamllint | 4 +- roles/bareos/README.md | 72 +++++++++---------- roles/bareos/defaults/main.yml | 22 +++--- .../install_add_bareos_fd_example.yml | 6 +- .../install_bareos_dir_webui_example.yml | 4 +- .../uninstall_bareos_dir_webui_example.yml | 4 +- roles/bareos/molecule/default/converge.yml | 4 +- roles/bareos/molecule/default/molecule.yml | 20 +++--- roles/bareos/molecule/default/prepare.yml | 2 +- roles/bareos/molecule/default/side_effect.yml | 14 ++-- roles/bareos/molecule/default/verify.yml | 10 +-- roles/bareos/tasks/add_bareos_repo_debian.yml | 4 +- roles/bareos/tasks/add_bareos_repo_redhat.yml | 6 +- roles/bareos/tasks/add_client.yml | 10 +-- roles/bareos/tasks/check_repo_url.yml | 2 +- roles/bareos/tasks/firewall_control.yml | 4 +- .../tasks/install_php_requirements_redhat.yml | 6 +- .../tasks/install_postgresql_alpine.yml | 6 +- .../tasks/install_postgresql_debian.yml | 6 +- .../bareos/tasks/install_postgresql_main.yml | 6 +- .../tasks/install_postgresql_redhat.yml | 6 +- roles/bareos/tasks/main.yml | 10 +-- .../tasks/pkg_management/install_dnf.yml | 2 +- .../tasks/pkg_management/install_yum.yml | 2 +- .../bareos/tasks/pkg_management/purge_dnf.yml | 2 +- roles/bareos/tasks/purge_bareos_alpine.yml | 2 +- roles/bareos/tasks/purge_bareos_debian.yml | 4 +- .../bareos/tasks/purge_postgresql_alpine.yml | 2 +- .../bareos/tasks/purge_postgresql_debian.yml | 4 +- .../bareos/tasks/purge_postgresql_redhat.yml | 2 +- roles/bareos/vars/main.yml | 4 +- roles/lxcfs/.ansible-lint | 2 +- roles/lxcfs/.yamllint | 4 +- roles/lxcfs/README.md | 14 ++-- roles/lxcfs/defaults/main.yml | 6 +- roles/lxcfs/examples/install_lxc2_0.yml | 8 +-- roles/lxcfs/examples/install_lxcfs_latest.yml | 10 +-- roles/lxcfs/handlers/main.yml | 2 +- roles/lxcfs/molecule/default/converge.yml | 2 +- .../lxcfs/molecule/default/defaults/main.yml | 4 +- roles/lxcfs/molecule/default/molecule.yml | 16 ++--- roles/lxcfs/molecule/default/verify.yml | 8 +-- roles/lxcfs/tasks/install.yml | 10 +-- roles/lxcfs/tasks/install_alpine.yml | 2 +- roles/lxcfs/tasks/install_redhat.yml | 4 +- roles/lxcfs/tasks/main.yml | 6 +- roles/lxcfs/tasks/modify_lxc_conf.yml | 2 +- roles/lxcfs/tasks/purge_packages_apk.yml | 4 +- roles/lxcfs/tasks/purge_packages_apt.yml | 4 +- roles/lxcfs/tasks/purge_packages_dnf.yml | 2 +- roles/lxcfs/tasks/uninstall_alpine.yml | 4 +- roles/lxcfs/tasks/uninstall_redhat.yml | 4 +- roles/lxcfs/templates/lxc.repo.j2 | 2 +- roles/lxcfs/templates/lxc_net_alpine.j2 | 2 +- roles/postgresql/.yamllint | 2 +- roles/postgresql/README.md | 12 ++-- roles/postgresql/defaults/main.yml | 6 +- .../install_control_and_reinstall_example.yml | 16 ++--- .../examples/install_pgadmin4_desktop.yml | 4 +- .../install_postgresql16_with_pgadmin.yml | 6 +- .../uninstall_postgresql16_with_pgadmin.yml | 8 +-- .../postgresql/molecule/default/converge.yml | 6 +- .../postgresql/molecule/default/molecule.yml | 32 ++++----- .../tasks/add_pgadmin_repo_debian.yml | 2 +- roles/zabbix_agent/README.md | 12 ++-- roles/zabbix_agent/defaults/main.yml | 14 ++-- .../examples/install_agent_example.yml | 8 +-- roles/zabbix_agent/handlers/main.yml | 2 +- .../molecule/default/converge.yml | 4 +- .../molecule/default/molecule.yml | 40 +++++------ .../molecule/default/side_effect.yml | 6 +- .../zabbix_agent/molecule/default/verify.yml | 10 +-- .../tasks/reconfigure_zabbix_agent.yml | 16 ++--- 80 files changed, 359 insertions(+), 309 deletions(-) create mode 100644 .github/workflows/mega_linter.yml diff --git a/.ansible-lint b/.ansible-lint index ee680f1..343465f 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -13,7 +13,7 @@ exclude_paths: - .gilab-ci.yml - .gitignore - .gitmodules -quiet: True +quiet: true verbosity: 1 # skip_list: diff --git a/.github/workflows/mega_linter.yml b/.github/workflows/mega_linter.yml new file mode 100644 index 0000000..59faa1d --- /dev/null +++ b/.github/workflows/mega_linter.yml @@ -0,0 +1,37 @@ +--- +name: MegaLinter +on: # yamllint disable-line rule:truthy + push: null + pull_request: + branches: + - main + - master +permissions: read-all + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + megalinter: + name: MegaLinter + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + pull-requests: read + statuses: write + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: MegaLinter + uses: oxsecurity/megalinter@latest + id: ml + env: + VALIDATE_ALL_CODEBASE: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.yamllint b/.yamllint index 16a4eba..02e4058 100644 --- a/.yamllint +++ b/.yamllint @@ -42,5 +42,5 @@ rules: type: unix trailing-spaces: enable truthy: - allowed-values: ['True', 'False'] - check-keys: True \ No newline at end of file + allowed-values: ['true', 'false'] + check-keys: true \ No newline at end of file diff --git a/LICENSE b/LICENSE index 4be6a84..4e242ce 100644 --- a/LICENSE +++ b/LICENSE @@ -1,15 +1,28 @@ - MIT No Attribution (MIT-0) - LICENSE +BSD 3-Clause License - Copyright 2018-2023, Aleksandr Bazhenov. +Copyright (c) 2018-2024, Aleksandr Bazhenov - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated - documentation files (the "Software"), to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO - THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/galaxy.yml b/galaxy.yml index 2bb0465..a1525f4 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -2,7 +2,7 @@ namespace: alexanderbazhenoff name: linux -version: 1.1.9 +version: 1.1.10 readme: README.md authors: - Aleksandr Bazhenov <> diff --git a/roles/.yamllint b/roles/.yamllint index 16a4eba..02e4058 100644 --- a/roles/.yamllint +++ b/roles/.yamllint @@ -42,5 +42,5 @@ rules: type: unix trailing-spaces: enable truthy: - allowed-values: ['True', 'False'] - check-keys: True \ No newline at end of file + allowed-values: ['true', 'false'] + check-keys: true \ No newline at end of file diff --git a/roles/bareos/.ansible-lint b/roles/bareos/.ansible-lint index 5913d6c..9d5968a 100644 --- a/roles/bareos/.ansible-lint +++ b/roles/bareos/.ansible-lint @@ -9,7 +9,7 @@ exclude_paths: - .gitignore - .gitmodules -quiet: True +quiet: true verbosity: 1 # skip_list: diff --git a/roles/bareos/.yamllint b/roles/bareos/.yamllint index 16a4eba..02e4058 100644 --- a/roles/bareos/.yamllint +++ b/roles/bareos/.yamllint @@ -42,5 +42,5 @@ rules: type: unix trailing-spaces: enable truthy: - allowed-values: ['True', 'False'] - check-keys: True \ No newline at end of file + allowed-values: ['true', 'false'] + check-keys: true \ No newline at end of file diff --git a/roles/bareos/README.md b/roles/bareos/README.md index 47ddad8..5cfcf18 100644 --- a/roles/bareos/README.md +++ b/roles/bareos/README.md @@ -92,9 +92,9 @@ tuning to speed up). #### 1. Install Bareos Director, Web UI, Storage, File daemon on the same host - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -110,9 +110,9 @@ tuning to speed up). #### 2. Make client user profile to access Bareos Web UI - hosts: bareos_server_host - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -124,7 +124,7 @@ tuning to speed up). webui_username: Admin webui_password: your_password_here webui_profile: webui-admin - webui_tls_enable: False + webui_tls_enable: false You can set `webui-admin`, `operator`, `webui-limited` or `webui-readonly` access level (webui_profile) [your profile needs](https://docs.bareos.org/IntroductionAndTutorial/BareosWebui.html#access-control-configuration). @@ -139,11 +139,11 @@ If you wish to prompt user and password during playbook execution: - name: "webui_username" prompt: "Enter username" default: "" - private: False + private: false - name: "webui_password" prompt: "Enter password" default: "" - private: True + private: true tasks: @@ -153,7 +153,7 @@ If you wish to prompt user and password during playbook execution: vars: role_action: access webui_profile: webui-admin - webui_tls_enable: False + webui_tls_enable: false #### 3. Install Bareos file daemon and add to server @@ -170,9 +170,9 @@ inventory file, e.g.: and ansible playbook like: - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -190,15 +190,15 @@ and ansible playbook like: vars: role_action: add_client add_component_server: "{{ groups.servers[0] }}" - debug_mode: True + debug_mode: true when: inventory_hostname in groups["clients"] #### 4. Install Bareos components with an additional list of packages - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -215,9 +215,9 @@ The example below shows how to install a client with only [**bareos-traymonitor**](https://docs.bareos.org/Configuration/Monitor.html) in the list of additional packages: - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -240,9 +240,9 @@ separately using `bareos_components` variable. The next example shows how to uni the host(s): - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -259,9 +259,9 @@ The next example shows how to skip PostgreSQL installation and copy Bareos direc role. Put your director configs to `files` folder of this role then run: - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -270,8 +270,8 @@ role. Put your director configs to `files` folder of this role then run: name: alexanderbazhenoff.linux.bareos vars: bareos_components: dir_webui - use_postgresql: True - preinstalled_postgresql: True + use_postgresql: true + preinstalled_postgresql: true bareos_configs_to_copy: - source: etc/ destination: /etc/bareos-dir.d @@ -282,8 +282,8 @@ Nothing will be additionally copied if `bareos_configs_to_copy` list is empty. If you wish to use Bareos with an already preinstalled sqlite change set: - use_postgresql: False - preinstalled_postgresql: True + use_postgresql: false + preinstalled_postgresql: true #### 7. Copy Bareos configs without reinstalling @@ -292,9 +292,9 @@ component(s) should be restarted to apply configuration change in `bareos_compon how to apply bareos-dir, bareos-sd, bareos-fd and Bareos Web UI (by restart Apache web server): - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -322,7 +322,7 @@ component(s). - **bareos_components** *[Default: fd, possible values: fd, sd, dir, webui, dir_webui]*: Bareos components to install or uninstall: Bareos file daemon or client *(fd)*, Bareos storage daemon *(sd)*, Bareos Director *(dir)*, Bareos director and Web UI *(dir_webui)*. -- **clean_install** *[Default: True]*: Perform clean installation. All packages and configs will be purged before +- **clean_install** *[Default: true]*: Perform clean installation. All packages and configs will be purged before install. - **bareos_release** *[Default: 21]*: [Bareos release version](https://download.bareos.org/bareos/release/), e.g.: 'current', 'next' or 'experimental/'. Affects only for Debian and Redhat Linux distribution families. @@ -332,15 +332,15 @@ install. Useful when specified Bareos version repo is not available for your Linux distribution version, but beware package dependencies problems (example: Bareos v21 currently is [not available](https://download.bareos.org/bareos/release/21/) for any RedHat v9, so try to set `8` here). -- **debug_mode** *[Default: False]*: Verbose output. +- **debug_mode** *[Default: false]*: Verbose output. #### Firewall related variables: -- **firewall_control** *[Default: True]*: Add firewall rules for firewalld and ufw. +- **firewall_control** *[Default: true]*: Add firewall rules for firewalld and ufw. #### Bareos related variables: -- **cleanup_storage_files** *[Default: True]*: Cleanup Bareos storage files on installation or uninstall. Please keep in +- **cleanup_storage_files** *[Default: true]*: Cleanup Bareos storage files on installation or uninstall. Please keep in mind these files are useless without an indexes stored in the database. - **install_additional_bareos_packages** *[Default: `[bareos-traymonitor]`]*: Additional Bareos packages to install: `[]`or `[bareos-traymonitor, bareos-vmware-plugin]`, etc... @@ -366,7 +366,7 @@ For creating client user profile to access Bareos Web UI (role_action == *'acces | webui_username | Admin | Profile username to login with. | | webui_password | admin | Profile password to login with. | | webui_profile | webui-admin | Access profile, e.g: webui-admin, operator, webui-readonly, webui-limited. | -| webui_tls_enable | False | Use TLS. | +| webui_tls_enable | false | Use TLS. | All available profiles are stored in the directory /etc/bareos/bareos-dir.d/profile (read [here](https://www.bareos.com/bareos-webui-installation-and-configuration/) for details). @@ -378,20 +378,20 @@ To add file daemon on Bareos server, you could define the next variables: | add_component_name | '' | Name to display on Bareos server (leave '' for FQDN or hostname). | | add_component_password | '' | Password to connect with (leave '' to generate random password). | | add_component_password_gen_length | 16 | Length of the password to generate. | -| add_component_tls_enable | False | Use TLS to connect between storage and server. | +| add_component_tls_enable | false | Use TLS to connect between storage and server. | | add_component_max_jobs | 1 | Maximum concurrent jobs on avalialable on file daemon. | | add_component_server | 127.0.0.1 | Bareos server IP address, hostname or inventory item to delegate. | -| add_component_force | False | Force try to add file daemon when already exists | +| add_component_force | false | Force try to add file daemon when already exists | #### Database related parameters: The most useful settings are stored in: -- **preinstalled_postgresql** *[Default: False]*: If you wish to use already preinstalled PostgreSQL. -- **use_postgresql** *[Default: True]*: Enable to use Bareos with PostgreSQL, disable for sqlite. +- **preinstalled_postgresql** *[Default: false]*: If you wish to use already preinstalled PostgreSQL. +- **use_postgresql** *[Default: true]*: Enable to use Bareos with PostgreSQL, disable for sqlite. - **postgresql_version** *[Default: 14]*: PostgreSQL version to install by this role. Leave it `''` for a default version. -- **install_psycopg2** *[Default: True]*: Install [psycopg2](https://pypi.org/project/psycopg2/). +- **install_psycopg2** *[Default: true]*: Install [psycopg2](https://pypi.org/project/psycopg2/). - **postgresql_timezone** *[Default: 'Europe/Moscow']*: PostgreSQL timezone (read [manual](https://www.postgresql.org/docs/15/datatype-datetime.html)). @@ -412,7 +412,7 @@ URL prefix for apt repo. ``` *]*: Debian PostgreSQL repo file content. - **postgresql_become_user: postgres** *[Default: postgres]*: PostgreSQL become user to init Bareos database. -- **init_bareos_database** *[Default: False]*: Call database and tables creation scripts. Required for old versions of +- **init_bareos_database** *[Default: false]*: Call database and tables creation scripts. Required for old versions of Bareos or CentOS, because install scripts inside the packages are different. License diff --git a/roles/bareos/defaults/main.yml b/roles/bareos/defaults/main.yml index 473bc00..a807978 100644 --- a/roles/bareos/defaults/main.yml +++ b/roles/bareos/defaults/main.yml @@ -21,7 +21,7 @@ role_action: install bareos_components: fd # Perform clean installation -clean_install: True +clean_install: true # Bareos release, e.g.: 'current', 'next' or 'experimental/' (https://download.bareos.org/). # If you have a valid Bareos subscription, please use the 'bareos/release/' (see @@ -38,19 +38,19 @@ override_ansible_distribution_major_version: bareos_url: https://download.bareos.org # More output for troubleshooting -debug_mode: False +debug_mode: false ### Firewall related parameters: # Add firewall rules (ufw or firewalld): -firewall_control: True +firewall_control: true ### Bareos related parameters: # Cleanup Bareos storage files on installation or uninstall: -cleanup_storage_files: True +cleanup_storage_files: true # Additional Bareos packages to install: [] or bareos-traymonitor, bareos-vmware-plugin etc... install_additional_bareos_packages: @@ -72,7 +72,7 @@ webui_username: Admin webui_password: admin # Access profile, e.g: webui-admin, webui-readonly, webui-limited, operator webui_profile: webui-admin -webui_tls_enable: False +webui_tls_enable: false # Default data to add a client on Bareos server. # @@ -83,25 +83,25 @@ add_component_password: '' # Length of the password to generate. add_component_password_gen_length: 16 # Use TLS to connect between file daemon and server. -add_component_tls_enable: False +add_component_tls_enable: false # Maximum concurrent jobs on available on file daemon. add_component_max_jobs: 1 # Bareos server IP address or hostname: add_component_server: 127.0.0.1 # Force try to add file daemon when already exists -add_component_force: False +add_component_force: false ### Database related parameters: # If you wish to use already preinstalled PostgreSQL. Mysql or Sqlite installations are not supported in this role. -preinstalled_postgresql: False +preinstalled_postgresql: false # Enable to use Bareos with PostgreSQL, disable for sqlite. -use_postgresql: True +use_postgresql: true # PostgreSQL version to install by this role. Leave it '' for a default version. postgresql_version: 14 # Install psycopg2: https://pypi.org/project/psycopg2/ -install_psycopg2: True +install_psycopg2: true # PostgreSQL timezone. Read manual: https://www.postgresql.org/docs/15/datatype-datetime.html postgresql_timezone: Europe/Moscow # Download PostgreSQL repository URL prefix. @@ -116,4 +116,4 @@ postgresql_debian_repo: > # PostgreSQL default user to init bareos database. Change when required for your custom database setup only. postgresql_become_user: postgres # Call database and tables creation scripts (required for old versions of Bareos) -init_bareos_database: True +init_bareos_database: true diff --git a/roles/bareos/examples/install_add_bareos_fd_example.yml b/roles/bareos/examples/install_add_bareos_fd_example.yml index dbb7593..ba47ffd 100644 --- a/roles/bareos/examples/install_add_bareos_fd_example.yml +++ b/roles/bareos/examples/install_add_bareos_fd_example.yml @@ -5,9 +5,9 @@ # ansible-playbook -i roles/bareos/inventory roles/bareos/install_bareos_fd_example.yml - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -25,5 +25,5 @@ vars: role_action: add_client add_component_server: "{{ groups.server[0] }}" - debug_mode: True + debug_mode: true when: inventory_hostname in groups["clients"] \ No newline at end of file diff --git a/roles/bareos/examples/install_bareos_dir_webui_example.yml b/roles/bareos/examples/install_bareos_dir_webui_example.yml index 6d8cd0f..4484550 100644 --- a/roles/bareos/examples/install_bareos_dir_webui_example.yml +++ b/roles/bareos/examples/install_bareos_dir_webui_example.yml @@ -5,9 +5,9 @@ # ansible-playbook -i roles/bareos/inventory roles/bareos/install_bareos_fd_example.yml - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: diff --git a/roles/bareos/examples/uninstall_bareos_dir_webui_example.yml b/roles/bareos/examples/uninstall_bareos_dir_webui_example.yml index 99b8547..b8ea5ce 100644 --- a/roles/bareos/examples/uninstall_bareos_dir_webui_example.yml +++ b/roles/bareos/examples/uninstall_bareos_dir_webui_example.yml @@ -5,9 +5,9 @@ # ansible-playbook -i roles/bareos/inventory roles/bareos/install_bareos_fd_example.yml - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: diff --git a/roles/bareos/molecule/default/converge.yml b/roles/bareos/molecule/default/converge.yml index b57f139..688a251 100644 --- a/roles/bareos/molecule/default/converge.yml +++ b/roles/bareos/molecule/default/converge.yml @@ -2,7 +2,7 @@ - name: Converge hosts: bareos_servers - become: True + become: true become_method: sudo tasks: @@ -16,4 +16,4 @@ postgresql_version: "{% if ansible_os_family == 'RedHat' and ansible_distribution_major_version | int == 8 -%} 13{% else %}14{% endif %}" init_bareos_database: "{{ (ansible_os_family == 'RedHat') }}" - debug_mode: True + debug_mode: true diff --git a/roles/bareos/molecule/default/molecule.yml b/roles/bareos/molecule/default/molecule.yml index 7b7c18a..c8e443b 100644 --- a/roles/bareos/molecule/default/molecule.yml +++ b/roles/bareos/molecule/default/molecule.yml @@ -3,8 +3,8 @@ dependency: name: galaxy options: - ignore-certs: True - ignore-errors: True + ignore-certs: true + ignore-errors: true driver: name: docker platforms: @@ -15,8 +15,8 @@ platforms: buildargs: image_platform: jrei/systemd-debian image_tag: 12 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -36,8 +36,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 20.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -57,8 +57,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 22.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -78,8 +78,8 @@ platforms: buildargs: image_platform: oraclelinux image_tag: 9 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp diff --git a/roles/bareos/molecule/default/prepare.yml b/roles/bareos/molecule/default/prepare.yml index d978423..a0a7d2d 100644 --- a/roles/bareos/molecule/default/prepare.yml +++ b/roles/bareos/molecule/default/prepare.yml @@ -2,7 +2,7 @@ - name: Prepare hosts: bareos_servers - become: True + become: true become_method: sudo tasks: diff --git a/roles/bareos/molecule/default/side_effect.yml b/roles/bareos/molecule/default/side_effect.yml index 29346dc..2b0d144 100644 --- a/roles/bareos/molecule/default/side_effect.yml +++ b/roles/bareos/molecule/default/side_effect.yml @@ -2,7 +2,7 @@ - name: Side effect hosts: all - become: True + become: true become_method: sudo tasks: @@ -19,8 +19,8 @@ vars: role_action: install bareos_components: fd - clean_install: False - debug_mode: True + clean_install: false + debug_mode: true when: inventory_hostname in groups["bareos_clients"] ### DEBUG SECTION (uncomment to troubleshoot) @@ -29,7 +29,7 @@ # ansible.builtin.debug: # msg: "grep by {{ ansible_hostname }} on the host {{ hostvars[inventory_hostname].bareos_dir }}" # delegate_to: "{{ hostvars[inventory_hostname].bareos_dir }}" - # delegate_facts: True + # delegate_facts: true # when: inventory_hostname in groups["bareos_clients"] - name: "default >>> side effect | Include bareos role to add bareos-client on bareos-dir" @@ -38,16 +38,16 @@ vars: role_action: add_client add_component_server: "{{ hostvars[inventory_hostname].bareos_dir }}" - debug_mode: True + debug_mode: true when: inventory_hostname in groups["bareos_clients"] - name: "default >>> side effect | Check client was added on the server" ansible.builtin.command: cmd: "echo 'list clients' | bconsole | grep {{ ansible_hostname }}" register: check_client_on_server_results - changed_when: False + changed_when: false failed_when: check_client_on_server_results.stdout is defined and check_client_on_server_results.stdout | length == 0 delegate_to: "{{ hostvars[inventory_hostname].bareos_dir }}" - delegate_facts: True + delegate_facts: true when: inventory_hostname in groups["bareos_clients"] diff --git a/roles/bareos/molecule/default/verify.yml b/roles/bareos/molecule/default/verify.yml index 4b7a7db..5b3a04e 100644 --- a/roles/bareos/molecule/default/verify.yml +++ b/roles/bareos/molecule/default/verify.yml @@ -2,8 +2,8 @@ - name: Verify hosts: bareos_servers - gather_facts: True - become: False + gather_facts: true + become: false tasks: @@ -18,15 +18,15 @@ url: "http://127.0.0.1/bareos-webui/" dest: "/tmp/{{ inventory_hostname }}_bareos_ansible_molecule_testing" mode: 0644 - force: True + force: true register: get_url_request_results - ignore_errors: True + ignore_errors: true - name: "default >>> verify | Read get_url file content" ansible.builtin.slurp: src: "/tmp/{{ inventory_hostname }}_bareos_ansible_molecule_testing" register: read_get_url_results - ignore_errors: True + ignore_errors: true - name: "default >>> verify | Assert bareos Web UI is working" ansible.builtin.assert: diff --git a/roles/bareos/tasks/add_bareos_repo_debian.yml b/roles/bareos/tasks/add_bareos_repo_debian.yml index 1b51c99..e9f1e4d 100644 --- a/roles/bareos/tasks/add_bareos_repo_debian.yml +++ b/roles/bareos/tasks/add_bareos_repo_debian.yml @@ -14,7 +14,7 @@ - name: "add bareos repo debian | (debug) Show repo URL" ansible.builtin.debug: var: repo_url_to_install - when: debug_mode | default(False) + when: debug_mode | default(false) - name: "add bareos repo debian | Include check bareos repo url tasks" ansible.builtin.include_tasks: check_repo_url.yml @@ -42,7 +42,7 @@ - name: "add bareos repo debian | Update apt packages cache" ansible.builtin.apt: - update_cache: True + update_cache: true register: apt_cache_results until: apt_cache_results is succeeded retries: 5 diff --git a/roles/bareos/tasks/add_bareos_repo_redhat.yml b/roles/bareos/tasks/add_bareos_repo_redhat.yml index 6481b38..6ece37f 100644 --- a/roles/bareos/tasks/add_bareos_repo_redhat.yml +++ b/roles/bareos/tasks/add_bareos_repo_redhat.yml @@ -38,19 +38,19 @@ - name: "add bareos repo redhat | (debug) Show repo URL" ansible.builtin.debug: var: bareos_repo_url - when: debug_mode | default(False) + when: debug_mode | default(false) - name: "add bareos repo redhat | Add GPG key" ansible.builtin.rpm_key: key: "{{ repo_url_to_install | replace('bareos.repo', 'RPM-GPG-KEY') }}" state: present - validate_certs: False + validate_certs: false - name: "add bareos repo redhat | Get bareos.repo file" ansible.builtin.get_url: url: "{{ repo_url_to_install }}" dest: /etc/yum.repos.d/bareos.repo - validate_certs: False + validate_certs: false mode: 0644 owner: root group: root diff --git a/roles/bareos/tasks/add_client.yml b/roles/bareos/tasks/add_client.yml index 275888d..382d601 100644 --- a/roles/bareos/tasks/add_client.yml +++ b/roles/bareos/tasks/add_client.yml @@ -12,7 +12,7 @@ args: executable: /bin/bash register: bconsole_list_results - changed_when: False + changed_when: false delegate_to: "{{ add_component_server | default(ansible_default_ipv4.address) }}" - name: "add client | Cleanup previous client configs (clean install)" @@ -44,9 +44,9 @@ (not add_component_force and bconsole_add_results.stdout is defined and bconsole_add_results.stdout | regex_search('Resource.*with name.*already exists')) or bconsole_add_results.failed changed_when: not bconsole_add_results.failed - ignore_errors: True + ignore_errors: true delegate_to: "{{ add_component_server | default(ansible_default_ipv4.address) }}" - no_log: "{{ not (debug_mode | default(False)) }}" + no_log: "{{ not (debug_mode | default(false)) }}" - name: "add cleint | Warn when file daemon client already exists on bareos server" ansible.builtin.debug: @@ -78,13 +78,13 @@ - name: "add client | (debug) Show export content of the config from bareos server" ansible.builtin.debug: msg: "{{ bareos_export_config_data.content | b64decode }}" - when: debug_mode | default(False) + when: debug_mode | default(false) - name: "add client | Export content of the config" ansible.builtin.copy: content: "{{ bareos_export_config_data.content | b64decode }}" dest: /etc/bareos/bareos-fd.d/director/bareos-dir.conf - force: True + force: true mode: 0640 owner: bareos group: bareos diff --git a/roles/bareos/tasks/check_repo_url.yml b/roles/bareos/tasks/check_repo_url.yml index a8f9100..147f671 100644 --- a/roles/bareos/tasks/check_repo_url.yml +++ b/roles/bareos/tasks/check_repo_url.yml @@ -4,5 +4,5 @@ ansible.builtin.uri: url: "{{ repo_url_to_install }}" register: check_repo_url_results - ignore_errors: True + ignore_errors: true failed_when: check_repo_url_results.status == 404 diff --git a/roles/bareos/tasks/firewall_control.yml b/roles/bareos/tasks/firewall_control.yml index 3d5af3a..494169b 100644 --- a/roles/bareos/tasks/firewall_control.yml +++ b/roles/bareos/tasks/firewall_control.yml @@ -3,8 +3,8 @@ - name: "firewall control | Add firewalld rule(s) (CentOS)" ansible.posix.firewalld: port: "{{ item }}/tcp" - permanent: True - immediate: True + permanent: true + immediate: true state: "{{ firewalld_rules_state | default('disabled') }}" when: firewall_control and ansible_os_family == 'RedHat' and firewalld_state.stdout is defined and firewalld_state.stdout == 'active' diff --git a/roles/bareos/tasks/install_php_requirements_redhat.yml b/roles/bareos/tasks/install_php_requirements_redhat.yml index 3dd6c3b..b46f7fe 100644 --- a/roles/bareos/tasks/install_php_requirements_redhat.yml +++ b/roles/bareos/tasks/install_php_requirements_redhat.yml @@ -7,7 +7,7 @@ ansible.builtin.package: name: "{{ item }}" state: present - ignore_errors: True + ignore_errors: true register: install_php_packages with_items: - "{{ php_package_dependencies }}" @@ -29,7 +29,7 @@ epel_repo_package_url: >- {% if ansible_distribution != 'Fedora' and ansible_distribution_major_version | int > 6 -%} {{ repo_url_to_install }}{% endif %} - check_epel_url_results: "{{ check_repo_url_results | default(True) }}" + check_epel_url_results: "{{ check_repo_url_results | default(true) }}" - name: "| Set remi repo package URL" ansible.builtin.set_fact: @@ -60,7 +60,7 @@ - name: "| Get default php version" ansible.builtin.command: php --version | head -1 - changed_when: False + changed_when: false register: php_version_results - name: "| Set fact for package list to install repositories" diff --git a/roles/bareos/tasks/install_postgresql_alpine.yml b/roles/bareos/tasks/install_postgresql_alpine.yml index 4203863..078ed5a 100644 --- a/roles/bareos/tasks/install_postgresql_alpine.yml +++ b/roles/bareos/tasks/install_postgresql_alpine.yml @@ -3,7 +3,7 @@ - name: "install postgresql alpine | heck postgresql version is available to download" ansible.builtin.shell: apk info postgresql{{ postgresql_version | default('') }} || true register: apk_info_postgresql_results - changed_when: False + changed_when: false - name: "install postgresql alpine | Assert availability of postgresql version repo" ansible.builtin.assert: @@ -16,7 +16,7 @@ - name: "install postgresql alpine | Install postgresql server packages" community.general.apk: name: "{{ item }}" - update_cache: True + update_cache: true register: postgresql_yum_results until: postgresql_yum_results is succeeded retries: 5 @@ -37,7 +37,7 @@ state: directory owner: "{{ postgresql_become_user }}" mode: 0700 - recurse: True + recurse: true when: postgresql_data_files_found.matched == 0 - name: "install postgresql alpine | Create {{ postgresql_become_user }} group" diff --git a/roles/bareos/tasks/install_postgresql_debian.yml b/roles/bareos/tasks/install_postgresql_debian.yml index e031264..c3d2650 100644 --- a/roles/bareos/tasks/install_postgresql_debian.yml +++ b/roles/bareos/tasks/install_postgresql_debian.yml @@ -5,7 +5,7 @@ url: "{{ postgresql_debian_apt_repo_url_prefix }}/dists/{{ ansible_distribution_release -}} -pgdg/{{ postgresql_version | default('') }}/" register: check_repo_url_results - ignore_errors: True + ignore_errors: true failed_when: check_repo_url_results.status == 404 - name: "install postgresql debian | Assert availability of postgresql version repo" @@ -28,7 +28,7 @@ url: "{{ postgresql_debian_key_url }}" dest: "{{ postgresql_debian_key_destination }}" mode: 0755 - validate_certs: False + validate_certs: false register: postgresql_apt_key_results until: postgresql_apt_key_results is succeeded retries: 5 @@ -37,7 +37,7 @@ - name: "install postgresql debian | Install debian repository" ansible.builtin.apt_repository: repo: "{{ postgresql_debian_repo }}" - update_cache: True + update_cache: true - name: "install postgresql debian | Install postgresql server packages" ansible.builtin.apt: diff --git a/roles/bareos/tasks/install_postgresql_main.yml b/roles/bareos/tasks/install_postgresql_main.yml index 79937f0..03cba84 100644 --- a/roles/bareos/tasks/install_postgresql_main.yml +++ b/roles/bareos/tasks/install_postgresql_main.yml @@ -18,17 +18,17 @@ - name: "install postgresql main | Check postgresql service is enabled" # noqa command-instead-of-module ansible.builtin.shell: systemctl is-enabled {{ postgresql_service_name }} || exit 0 register: service_enabled_results - changed_when: False + changed_when: false - name: "install postgresql main | Check postgresql service is active" # noqa command-instead-of-module ansible.builtin.shell: systemctl is-active {{ postgresql_service_name }} || exit 0 register: service_running_results - changed_when: False + changed_when: false - name: "install postgresql main | Enable postgresql if not enabled after install" ansible.builtin.service: name: "{{ postgresql_service_name }}" - enabled: True + enabled: true when: service_enabled_results.stdout is not defined or 'enabled' not in service_enabled_results.stdout - name: "install postgresql main | Start postgresql if not started after install" diff --git a/roles/bareos/tasks/install_postgresql_redhat.yml b/roles/bareos/tasks/install_postgresql_redhat.yml index 8f7fa0e..1affa37 100644 --- a/roles/bareos/tasks/install_postgresql_redhat.yml +++ b/roles/bareos/tasks/install_postgresql_redhat.yml @@ -4,7 +4,7 @@ ansible.builtin.rpm_key: key: "{{ postgresql_url }}repos/yum/RPM-GPG-KEY-PGDG" state: present - validate_certs: False + validate_certs: false - name: "install postgresql redhat | Include check repo url tasks" ansible.builtin.include_tasks: check_postgresql_repo_url_redhat.yml @@ -13,7 +13,7 @@ ansible.builtin.shell: dnf -qy module list | grep 'postgresql' {% if postgresql_version | string | length > 0 %} | grep {{ postgresql_version }}{% endif %} || true register: dnf_postgresql_module_results - changed_when: False + changed_when: false when: ansible_pkg_mgr == 'dnf' - name: "install postgresql redhat | Enable postgresql module version" @@ -21,7 +21,7 @@ dnf -qy module enable postgresql{% if postgresql_version | string in dnf_postgresql_module_results.stdout and postgresql_version | int > 0 %}:{{ postgresql_version }}{% endif -%} register: dnf_postgresql_enable_results - changed_when: True + changed_when: true when: ansible_pkg_mgr == 'dnf' - name: "install postgresql redhat | Assert availability of postgresql version repo or dnf module" diff --git a/roles/bareos/tasks/main.yml b/roles/bareos/tasks/main.yml index 715a357..718ae0f 100644 --- a/roles/bareos/tasks/main.yml +++ b/roles/bareos/tasks/main.yml @@ -2,16 +2,16 @@ - name: "main | Check firewalld is running (RedHat)" # noqa command-instead-of-module ansible.builtin.command: systemctl is-active firewalld - ignore_errors: True + ignore_errors: true register: firewalld_state - changed_when: False + changed_when: false when: role_action | regex_search('install') and ansible_os_family == 'RedHat' and firewall_control - name: "main | Check ufw exists and running (Ubuntu)" ansible.builtin.command: ufw status - ignore_errors: True + ignore_errors: true register: ufw_state - changed_when: False + changed_when: false when: role_action | regex_search('install') and ansible_distribution == 'Ubuntu' and firewall_control - name: "main | Cleanup bareos component(s)" @@ -20,7 +20,7 @@ ansible.builtin.include_tasks: "purge_bareos_{{ ansible_os_family | lower }}.yml" - name: "| Set swap bareos web packages flag" ansible.builtin.set_fact: - swap_bareos_web_packages: True + swap_bareos_web_packages: true - name: "| Cleanup bareos-related files and folders" ansible.builtin.file: path: "{{ item | trim }}" diff --git a/roles/bareos/tasks/pkg_management/install_dnf.yml b/roles/bareos/tasks/pkg_management/install_dnf.yml index d9a6364..6df1b18 100644 --- a/roles/bareos/tasks/pkg_management/install_dnf.yml +++ b/roles/bareos/tasks/pkg_management/install_dnf.yml @@ -4,7 +4,7 @@ ansible.builtin.dnf: name: "{{ item }}" state: latest - update_cache: True + update_cache: true register: install_yum_results until: install_yum_results is succeeded retries: 5 diff --git a/roles/bareos/tasks/pkg_management/install_yum.yml b/roles/bareos/tasks/pkg_management/install_yum.yml index 01602b0..a8a317c 100644 --- a/roles/bareos/tasks/pkg_management/install_yum.yml +++ b/roles/bareos/tasks/pkg_management/install_yum.yml @@ -4,7 +4,7 @@ ansible.builtin.yum: name: "{{ item }}" state: latest - update_cache: True + update_cache: true register: install_yum_results until: install_yum_results is succeeded retries: 5 diff --git a/roles/bareos/tasks/pkg_management/purge_dnf.yml b/roles/bareos/tasks/pkg_management/purge_dnf.yml index 915d65a..4532418 100644 --- a/roles/bareos/tasks/pkg_management/purge_dnf.yml +++ b/roles/bareos/tasks/pkg_management/purge_dnf.yml @@ -4,7 +4,7 @@ ansible.builtin.dnf: name: "{{ item }}" state: absent - autoremove: True + autoremove: true when: item | length > 0 with_items: - "{{ packages_to_install }}" diff --git a/roles/bareos/tasks/purge_bareos_alpine.yml b/roles/bareos/tasks/purge_bareos_alpine.yml index 74b54c1..968eb44 100644 --- a/roles/bareos/tasks/purge_bareos_alpine.yml +++ b/roles/bareos/tasks/purge_bareos_alpine.yml @@ -4,7 +4,7 @@ community.general.apk: name: "{{ item }}" state: absent - available: True + available: true when: item is defined and item is not none and item | length > 0 with_items: - "{{ bareos_packages | json_query(bareos_components) + install_additional_bareos_packages }}" diff --git a/roles/bareos/tasks/purge_bareos_debian.yml b/roles/bareos/tasks/purge_bareos_debian.yml index f6669cf..aed5b9c 100644 --- a/roles/bareos/tasks/purge_bareos_debian.yml +++ b/roles/bareos/tasks/purge_bareos_debian.yml @@ -4,8 +4,8 @@ ansible.builtin.apt: name: "{{ item }}" state: absent - autoremove: True - purge: True + autoremove: true + purge: true when: item is defined and item is not none and item | length > 0 with_items: - "{{ bareos_packages | json_query(bareos_components) + install_additional_bareos_packages }}" diff --git a/roles/bareos/tasks/purge_postgresql_alpine.yml b/roles/bareos/tasks/purge_postgresql_alpine.yml index 3636fe4..9a2befe 100644 --- a/roles/bareos/tasks/purge_postgresql_alpine.yml +++ b/roles/bareos/tasks/purge_postgresql_alpine.yml @@ -32,7 +32,7 @@ ansible.builtin.user: name: "{{ postgresql_become_user }}" state: absent - remove: True + remove: true - name: "purge postgresql alpine | Remove {{ postgresql_become_user }} group" ansible.builtin.group: diff --git a/roles/bareos/tasks/purge_postgresql_debian.yml b/roles/bareos/tasks/purge_postgresql_debian.yml index b80b55c..80520aa 100644 --- a/roles/bareos/tasks/purge_postgresql_debian.yml +++ b/roles/bareos/tasks/purge_postgresql_debian.yml @@ -4,8 +4,8 @@ ansible.builtin.apt: name: "{{ item }}" state: absent - autoremove: True - purge: True + autoremove: true + purge: true when: item is defined and item is not none and item | length > 0 with_items: - "{{ postgresql_packages | diff --git a/roles/bareos/tasks/purge_postgresql_redhat.yml b/roles/bareos/tasks/purge_postgresql_redhat.yml index 47b684b..53164ad 100644 --- a/roles/bareos/tasks/purge_postgresql_redhat.yml +++ b/roles/bareos/tasks/purge_postgresql_redhat.yml @@ -7,7 +7,7 @@ ansible.builtin.rpm_key: key: "{{ postgresql_url }}repos/yum/RPM-GPG-KEY-PGDG" state: absent - validate_certs: False + validate_certs: false - name: "purge postgresql redhat | Set postgresql server package(s) list" ansible.builtin.set_fact: diff --git a/roles/bareos/vars/main.yml b/roles/bareos/vars/main.yml index b9bd89c..3ae23aa 100644 --- a/roles/bareos/vars/main.yml +++ b/roles/bareos/vars/main.yml @@ -120,11 +120,11 @@ postgresql_packages: - postgresql{{ '-' ~ postgresql_version | default('') }} redhat_psycopg2: - postgresql{% if dnf_postgresql_enable_results.stdout is not defined and not check_repo_url_results.failed | - default(False) %}{{ postgresql_version | default('') }}{% endif %}-server + default(false) %}{{ postgresql_version | default('') }}{% endif %}-server - python{{ ansible_python.version.major }}-psycopg2 redhat: - postgresql{% if dnf_postgresql_enable_results.stdout is not defined and not check_repo_url_results.failed | - default(False) %}{{ postgresql_version | default('') }}{% endif %}-server + default(false) %}{{ postgresql_version | default('') }}{% endif %}-server alpine: - postgresql{{ postgresql_version | default('') }} alpine_psycopg2: diff --git a/roles/lxcfs/.ansible-lint b/roles/lxcfs/.ansible-lint index ee680f1..343465f 100644 --- a/roles/lxcfs/.ansible-lint +++ b/roles/lxcfs/.ansible-lint @@ -13,7 +13,7 @@ exclude_paths: - .gilab-ci.yml - .gitignore - .gitmodules -quiet: True +quiet: true verbosity: 1 # skip_list: diff --git a/roles/lxcfs/.yamllint b/roles/lxcfs/.yamllint index 394f787..254f21b 100644 --- a/roles/lxcfs/.yamllint +++ b/roles/lxcfs/.yamllint @@ -41,5 +41,5 @@ rules: type: unix trailing-spaces: enable truthy: - allowed-values: ['True', 'False'] - check-keys: True \ No newline at end of file + allowed-values: ['true', 'false'] + check-keys: true \ No newline at end of file diff --git a/roles/lxcfs/README.md b/roles/lxcfs/README.md index f8f77ab..38f8995 100644 --- a/roles/lxcfs/README.md +++ b/roles/lxcfs/README.md @@ -18,7 +18,7 @@ is no lxcfs for 2.0, only lxc. - `lxc_technology` - container technology to install: `lxc` or `lxcfs`. - `lxc_gpg_keyserver` - add LXC GPG keyserver (`DOWNLOAD_KEYSERVER`) to environment variables, e.g: `keyserver.ubuntu.com`. -- `check_host_is_lxc_ready` - check host is lxc-ready (run `lxc-checkconfig` command when *True*). Version of lxc may +- `check_host_is_lxc_ready` - check host is lxc-ready (run `lxc-checkconfig` command when *true*). Version of lxc may differ from distribution to distribution where lxc-checkconfig script could be [a bit outdated](https://github.com/lxc/lxc/issues/4070#issuecomment-1374883653). - `append_lxc_config` - append config lines to default lxc config. Paste something for default container settings, e.g: @@ -48,7 +48,7 @@ for LXC2.0. So `append_lxc_config` lines will append to all new created containe ## lxc-net settings - `use_lxc_default_net` - use default lxc bridge-nat network (`lxc-net` daemon) bind to `lxc_default_net_bridge` -interface. Disable (set `False`) if you want to connect with host bridge, pass-through, etc. +interface. Disable (set `false`) if you want to connect with host bridge, pass-through, etc. - `lxc_default_net_bridge` - name of the interface for bridge-nat network (default: `xcbr0`). - `lxc_default_net_addr` - IP address for `xcbr0`, e.g: `"10.0.3.1"`. - `lxc_default_net_netmask` - subnet mask for bridge-nat network, e.g.: `"255.255.255.0"`. @@ -62,9 +62,9 @@ Example Playbook Simple lxc role usage with defaults is: - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: - name: Include lxc(fs) role @@ -80,9 +80,9 @@ You can also switch to lxcfs with: More complex lxcfs usage with disabled default lxc-net for br0 usage with some static addresses should look like: - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -93,7 +93,7 @@ More complex lxcfs usage with disabled default lxc-net for br0 usage with some s name: alexanderbazhenoff.linux.lxcfs vars: lxc_technology: lxcfs - use_lxc_default_net: False + use_lxc_default_net: false lxc_append_default_config: | lxc.net.0.type = veth lxc.net.0.link = br0 diff --git a/roles/lxcfs/defaults/main.yml b/roles/lxcfs/defaults/main.yml index b3c2ce6..5822ea6 100644 --- a/roles/lxcfs/defaults/main.yml +++ b/roles/lxcfs/defaults/main.yml @@ -5,7 +5,7 @@ # Role action: install or uninstall role_action: install # Perform clean install -clean_install: True +clean_install: true # Version of lxc/lxcfs. Affects only on RedHat repository URL. Please note: there is no lxcfs for 2.0, only lxc. lxc_version: '3.0' @@ -16,13 +16,13 @@ lxc_technology: lxcfs lxc_gpg_keyserver: keyserver.ubuntu.com # Check host is ready for lxc usage -check_host_is_lxc_ready: True +check_host_is_lxc_ready: true ### lxc-net settings ### # Disable if you want to connect with host bridge, pass-through, etc.. -use_lxc_default_net: False +use_lxc_default_net: false # Default lxc-net settings: lxc_default_net_bridge: "lxcbr0" lxc_default_net_addr: "10.0.3.1" diff --git a/roles/lxcfs/examples/install_lxc2_0.yml b/roles/lxcfs/examples/install_lxc2_0.yml index 14cbec0..6891f68 100644 --- a/roles/lxcfs/examples/install_lxc2_0.yml +++ b/roles/lxcfs/examples/install_lxc2_0.yml @@ -1,9 +1,9 @@ --- - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -11,8 +11,8 @@ ansible.builtin.include_role: name: alexanderbazhenoff.linux.lxcfs vars: - use_lxc_default_net: True - clean_install: True + use_lxc_default_net: true + clean_install: true lxc_technology: lxc lxc_version: '2.0' append_lxc_config: | diff --git a/roles/lxcfs/examples/install_lxcfs_latest.yml b/roles/lxcfs/examples/install_lxcfs_latest.yml index a6d9474..97a9fe0 100644 --- a/roles/lxcfs/examples/install_lxcfs_latest.yml +++ b/roles/lxcfs/examples/install_lxcfs_latest.yml @@ -1,9 +1,9 @@ --- - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -11,9 +11,9 @@ ansible.builtin.include_role: name: alexanderbazhenoff.linux.lxcfs vars: - use_lxc_default_net: True - clean_install: True - check_host_is_lxc_ready: False + use_lxc_default_net: true + clean_install: true + check_host_is_lxc_ready: false append_lxc_config: | lxc.net.0.type = veth lxc.net.0.link = lxcbr0 diff --git a/roles/lxcfs/handlers/main.yml b/roles/lxcfs/handlers/main.yml index 67b4791..2e4522a 100644 --- a/roles/lxcfs/handlers/main.yml +++ b/roles/lxcfs/handlers/main.yml @@ -4,7 +4,7 @@ ansible.builtin.service: name: "{{ item }}" state: restarted - enabled: True + enabled: true when: item | length > 0 with_items: - "{% if ansible_os_family == 'Alpine' %}cgroups{% endif %}" diff --git a/roles/lxcfs/molecule/default/converge.yml b/roles/lxcfs/molecule/default/converge.yml index f321838..6a27662 100644 --- a/roles/lxcfs/molecule/default/converge.yml +++ b/roles/lxcfs/molecule/default/converge.yml @@ -2,7 +2,7 @@ - name: Converge hosts: all - become: True + become: true become_method: sudo tasks: diff --git a/roles/lxcfs/molecule/default/defaults/main.yml b/roles/lxcfs/molecule/default/defaults/main.yml index f201c6d..23042b8 100644 --- a/roles/lxcfs/molecule/default/defaults/main.yml +++ b/roles/lxcfs/molecule/default/defaults/main.yml @@ -1,8 +1,8 @@ --- lxc_technology: lxc -use_lxc_default_net: True -check_host_is_lxc_ready: False +use_lxc_default_net: true +check_host_is_lxc_ready: false append_lxc_config: | lxc.net.0.type = veth lxc.net.0.link = lxcbr0 diff --git a/roles/lxcfs/molecule/default/molecule.yml b/roles/lxcfs/molecule/default/molecule.yml index cc9a15f..37e3af4 100644 --- a/roles/lxcfs/molecule/default/molecule.yml +++ b/roles/lxcfs/molecule/default/molecule.yml @@ -3,8 +3,8 @@ dependency: name: galaxy options: - ignore-certs: True - ignore-errors: True + ignore-certs: true + ignore-errors: true driver: name: docker platforms: @@ -15,8 +15,8 @@ platforms: buildargs: image_platform: jrei/systemd-debian image_tag: 11 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -33,8 +33,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 20.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -51,8 +51,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 22.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp diff --git a/roles/lxcfs/molecule/default/verify.yml b/roles/lxcfs/molecule/default/verify.yml index 35f9166..065dcd9 100644 --- a/roles/lxcfs/molecule/default/verify.yml +++ b/roles/lxcfs/molecule/default/verify.yml @@ -2,8 +2,8 @@ - name: Verify hosts: all - gather_facts: True - become: True + gather_facts: true + become: true become_method: sudo tasks: @@ -31,12 +31,12 @@ - name: "default >>> verify | Start container" ansible.builtin.command: lxc-start ubuntu-focal - changed_when: True + changed_when: true - name: "default >>> verify | Get container state" # noqa risky-shell-pipe ansible.builtin.shell: lxc-ls -f | tail -1 register: lxc_container_results - changed_when: False + changed_when: false - name: "default >>> verify | Make sure the container is running" ansible.builtin.assert: diff --git a/roles/lxcfs/tasks/install.yml b/roles/lxcfs/tasks/install.yml index 7cf0ff0..dd900ff 100644 --- a/roles/lxcfs/tasks/install.yml +++ b/roles/lxcfs/tasks/install.yml @@ -17,7 +17,7 @@ regexp: "#?{{ item.key }}=" line: '{{ item.key }}="{{ item.value }}"' state: present - create: True + create: true mode: 0644 owner: root group: root @@ -41,8 +41,8 @@ recurse: "{{ item.recurse }}" mode: 0644 with_items: - - { path: /etc/lxc, state: directory, recurse: True } - - { path: /etc/lxc/dnsmasq.conf, state: touch, recurse: False } + - { path: /etc/lxc, state: directory, recurse: true } + - { path: /etc/lxc/dnsmasq.conf, state: touch, recurse: false } - name: "install | Include modify lxc conf tasks" ansible.builtin.include_tasks: modify_lxc_conf.yml @@ -65,7 +65,7 @@ regexp: "^net.ipv4.ip_forward=" line: net.ipv4.ip_forward=1 state: present - create: True + create: true mode: 0644 when: use_lxc_default_net @@ -78,6 +78,6 @@ - name: "install | Check host is ready for lxc usage (lxc-checkconfig)" # noqa risky-shell-pipe ansible.builtin.shell: lxc-checkconfig | grep -v "CONFIG_NF_NAT_IPV" | grep -iE "(missing|required)" register: lxc_check_results - changed_when: False + changed_when: false failed_when: lxc_check_results.stdout | length > 0 when: check_host_is_lxc_ready diff --git a/roles/lxcfs/tasks/install_alpine.yml b/roles/lxcfs/tasks/install_alpine.yml index 3e03e16..16ae658 100644 --- a/roles/lxcfs/tasks/install_alpine.yml +++ b/roles/lxcfs/tasks/install_alpine.yml @@ -2,7 +2,7 @@ - name: "install alpine | Refresh kernel modules available" ansible.builtin.command: depmod - changed_when: False + changed_when: false - name: "install alpine | Load required kernel modules" community.general.modprobe: diff --git a/roles/lxcfs/tasks/install_redhat.yml b/roles/lxcfs/tasks/install_redhat.yml index 492355e..bd1e6be 100644 --- a/roles/lxcfs/tasks/install_redhat.yml +++ b/roles/lxcfs/tasks/install_redhat.yml @@ -4,8 +4,8 @@ ansible.posix.firewalld: service: "{{ item }}" state: enabled - permanent: True - immediate: True + permanent: true + immediate: true when: firewalld_state.stdout is defined and firewalld_state.stdout == 'active' with_items: - dhcp diff --git a/roles/lxcfs/tasks/main.yml b/roles/lxcfs/tasks/main.yml index 02fa948..f8b8e31 100644 --- a/roles/lxcfs/tasks/main.yml +++ b/roles/lxcfs/tasks/main.yml @@ -14,7 +14,7 @@ - name: "main | Upgrade apt package cache" ansible.builtin.apt: - update_cache: True + update_cache: true when: ansible_pkg_mgr == 'apt' - name: "main | Install packages tasks (pre-requirements install)" @@ -42,12 +42,12 @@ - name: "main | Check firewalld is running" # noqa command-instead-of-module ansible.builtin.shell: systemctl is-active firewalld || true register: firewalld_state - changed_when: False + changed_when: false - name: "main | Check ufw status" ansible.builtin.shell: ufw status || true register: ufw_state - changed_when: False + changed_when: false - name: "main | Include {{ role_action }} tasks" ansible.builtin.include_tasks: "{{ role_action }}.yml" diff --git a/roles/lxcfs/tasks/modify_lxc_conf.yml b/roles/lxcfs/tasks/modify_lxc_conf.yml index cd45a71..475115c 100644 --- a/roles/lxcfs/tasks/modify_lxc_conf.yml +++ b/roles/lxcfs/tasks/modify_lxc_conf.yml @@ -11,7 +11,7 @@ - name: "modify lxc conf | Read existing lxc config" ansible.builtin.shell: cat /etc/lxc/default.conf || true register: existing_config_raw - changed_when: False + changed_when: false - name: "modify lxc conf | Set fact of config changes" ansible.builtin.set_fact: diff --git a/roles/lxcfs/tasks/purge_packages_apk.yml b/roles/lxcfs/tasks/purge_packages_apk.yml index 1b59782..dd75034 100644 --- a/roles/lxcfs/tasks/purge_packages_apk.yml +++ b/roles/lxcfs/tasks/purge_packages_apk.yml @@ -5,10 +5,10 @@ name: "{{ item }}" state: absent register: purge_packages_apk - ignore_errors: True + ignore_errors: true when: item | length > 0 with_items: - - "{{ lxc_install_packages | sort(reverse=True) }}" + - "{{ lxc_install_packages | sort(reverse=true) }}" - name: "pure packages apk | Force delete packages (with apk command)" ansible.builtin.shell: | diff --git a/roles/lxcfs/tasks/purge_packages_apt.yml b/roles/lxcfs/tasks/purge_packages_apt.yml index e36b314..4c131a7 100644 --- a/roles/lxcfs/tasks/purge_packages_apt.yml +++ b/roles/lxcfs/tasks/purge_packages_apt.yml @@ -4,8 +4,8 @@ ansible.builtin.apt: name: "{{ item }}" state: absent - autoremove: True - purge: True + autoremove: true + purge: true when: item | length > 0 with_items: - "{{ lxc_install_packages }}" diff --git a/roles/lxcfs/tasks/purge_packages_dnf.yml b/roles/lxcfs/tasks/purge_packages_dnf.yml index 219ca32..0bd2575 100644 --- a/roles/lxcfs/tasks/purge_packages_dnf.yml +++ b/roles/lxcfs/tasks/purge_packages_dnf.yml @@ -4,7 +4,7 @@ ansible.builtin.dnf: name: "{{ item }}" state: absent - autoremove: True + autoremove: true when: item | length > 0 with_items: - "{{ lxc_install_packages }}" diff --git a/roles/lxcfs/tasks/uninstall_alpine.yml b/roles/lxcfs/tasks/uninstall_alpine.yml index f350cd6..bf81f45 100644 --- a/roles/lxcfs/tasks/uninstall_alpine.yml +++ b/roles/lxcfs/tasks/uninstall_alpine.yml @@ -3,7 +3,7 @@ - name: "uninstall alpine | Count the number of iptables rules" # noqa risky-shell-pipe ansible.builtin.shell: iptables --list --line-numbers | sed '/^num\|^$\|^Chain/d' | wc -l register: iptables_rules_number - changed_when: False + changed_when: false - name: "uninstall alpine | Stop services via rc-service" ansible.builtin.shell: rc-service {{ item }} stop || true @@ -31,7 +31,7 @@ - name: "uninstall alpine | Count dummy interfaces number on the host" # noqa risky-shell-pipe ansible.builtin.shell: ip a | grep dummy | wc -l register: dummy_eth_results - changed_when: False + changed_when: false - name: "uninstall alpine | Remove kernel module(s) from autoload" ansible.builtin.lineinfile: diff --git a/roles/lxcfs/tasks/uninstall_redhat.yml b/roles/lxcfs/tasks/uninstall_redhat.yml index d413afc..c9fad1c 100644 --- a/roles/lxcfs/tasks/uninstall_redhat.yml +++ b/roles/lxcfs/tasks/uninstall_redhat.yml @@ -4,8 +4,8 @@ ansible.posix.firewalld: service: "{{ item }}" state: disabled - permanent: True - immediate: True + permanent: true + immediate: true when: firewalld_state.stdout is defined and firewalld_state.stdout == 'active' with_items: - dhcp diff --git a/roles/lxcfs/templates/lxc.repo.j2 b/roles/lxcfs/templates/lxc.repo.j2 index b49a601..0015ad4 100644 --- a/roles/lxcfs/templates/lxc.repo.j2 +++ b/roles/lxcfs/templates/lxc.repo.j2 @@ -3,7 +3,7 @@ name=Copr repo for lxc{{ lxc_version }} owned by thm baseurl={{ redhat_repo_url }}/{% if ansible_distribution == 'Fedora' %}fedora-rawhide{% else -%} epel-{{ ansible_distribution_major_version }}{% endif %}-$basearch/ type=rpm-md -skip_if_unavailable=True +skip_if_unavailable=true gpgcheck=1 gpgkey={{ redhat_repo_url }}/pubkey.gpg repo_gpgcheck=0 diff --git a/roles/lxcfs/templates/lxc_net_alpine.j2 b/roles/lxcfs/templates/lxc_net_alpine.j2 index 50fc163..1ba350b 100644 --- a/roles/lxcfs/templates/lxc_net_alpine.j2 +++ b/roles/lxcfs/templates/lxc_net_alpine.j2 @@ -1,4 +1,4 @@ -{% if True %}#!/sbin/openrc-run{% endif %} +{% if true %}#!/sbin/openrc-run{% endif %} # lxc-net Alpine Linux init script for openrc # diff --git a/roles/postgresql/.yamllint b/roles/postgresql/.yamllint index 16a4eba..4cdd628 100644 --- a/roles/postgresql/.yamllint +++ b/roles/postgresql/.yamllint @@ -42,5 +42,5 @@ rules: type: unix trailing-spaces: enable truthy: - allowed-values: ['True', 'False'] + allowed-values: ['True', 'false'] check-keys: True \ No newline at end of file diff --git a/roles/postgresql/README.md b/roles/postgresql/README.md index b6e5127..9d8dcbf 100644 --- a/roles/postgresql/README.md +++ b/roles/postgresql/README.md @@ -62,9 +62,9 @@ Example Playbooks The shortest example playbook of database instance installation should look like: - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -82,13 +82,13 @@ while uninstall of the same version playbook tasks should look like: Role checks that specified version of PostgreSQL server is available for your Linux distribution: if this version is not available, this will install a default version from your distribution repositories or from dnf modules. If you wish to -install PostgreSQL of a default version for your linux destribution set `postgresql_recommended_version: True`: +install PostgreSQL of a default version for your linux destribution set `postgresql_recommended_version: true`: - name: "Install PostgreSQL of default version for your linux destribution" ansible.builtin.include_role: name: alexanderbazhenoff.linux.postgresql vars: - postgresql_recommended_version: True + postgresql_recommended_version: true More complex examples may include different customisations: @@ -97,7 +97,7 @@ More complex examples may include different customisations: name: alexanderbazhenoff.linux.postgresql vars: postgresql_version: 16 - install_pgadmin: True + install_pgadmin: true pgadmin_email: john.doe@company.com pgadmin_password: some_password_here postgresql_additional_packages: @@ -268,7 +268,7 @@ Using this role all `postgresql.conf` change actions ends up with postgresql dae postgresql_users: - name: test database: acme - fail_on_user: False + fail_on_user: false - name: "Connect to test database and remove an existing user's password" ansible.builtin.include_role: diff --git a/roles/postgresql/defaults/main.yml b/roles/postgresql/defaults/main.yml index d9a06c6..b0a9708 100644 --- a/roles/postgresql/defaults/main.yml +++ b/roles/postgresql/defaults/main.yml @@ -20,10 +20,10 @@ cleanup_data_directory: True # Install only a maximum recommended version based on dnf profile (https://www.postgresql.org/download/linux/redhat/) # Affects only for systems with dnf package manager. Also read about dnf modules in specified Linux distribution, e.g.: # https://docs.fedoraproject.org/en-US/modularity/using-modules/ -postgresql_recommended_version: False +postgresql_recommended_version: false # List of additional PostgreSQL related packages, e.g.: 'postgresql-contrib' or 'postgresql14-contrib' for -# postgresql_recommended_version: False. So there is no automated version handling in this list, you should include +# postgresql_recommended_version: false. So there is no automated version handling in this list, you should include # versions to package names. postgresql_additional_packages: [] @@ -31,7 +31,7 @@ postgresql_additional_packages: [] install_psycopg2: True # Install pgadmin for web mode with postgresql server: https://www.pgadmin.org/ -install_pgadmin: False +install_pgadmin: false # Pgadmin installation type: web or desktop. Leave them empty to install both web and desktop. pgadmin_installation_type: web diff --git a/roles/postgresql/examples/install_control_and_reinstall_example.yml b/roles/postgresql/examples/install_control_and_reinstall_example.yml index d5c6343..156891f 100644 --- a/roles/postgresql/examples/install_control_and_reinstall_example.yml +++ b/roles/postgresql/examples/install_control_and_reinstall_example.yml @@ -8,9 +8,9 @@ # ansible-playbook -i roles/postgresql/inventory.ini roles/postgresql/install_control_and_reinstall_example.yml - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -20,8 +20,8 @@ vars: role_action: install postgresql_version: 15 - clean_install: True - install_pgadmin: True + clean_install: true + install_pgadmin: true role_subject: server pg_conf_content_mode: >- {% if ansible_os_family == 'RedHat' and ansible_distribution_major_version | int <= 6 %}regex{% else -%} @@ -58,7 +58,7 @@ ansible.builtin.lineinfile: dest: /tmp/acme.dir line: "-- PostgreSQL database dump complete" - check_mode: True + check_mode: true register: dump_complete_line_results failed_when: dump_complete_line_results.changed @@ -68,7 +68,7 @@ vars: role_action: uninstall postgresql_version: 14 - clean_install: True + clean_install: true postgresql_additional_packages: - "postgresql{% if ansible_os_family == 'Debian' %}-client-14{% else %}14-contrib{% endif %}" @@ -78,8 +78,8 @@ vars: role_action: uninstall postgresql_version: 14 - postgresql_max_recommended_version: True - clean_install: True + postgresql_max_recommended_version: true + clean_install: true postgresql_additional_packages: - "postgresql{% if ansible_os_family == 'Debian' %}-client-14{% else %}14-contrib{% endif %}" diff --git a/roles/postgresql/examples/install_pgadmin4_desktop.yml b/roles/postgresql/examples/install_pgadmin4_desktop.yml index 3d7b719..c6c9cb8 100644 --- a/roles/postgresql/examples/install_pgadmin4_desktop.yml +++ b/roles/postgresql/examples/install_pgadmin4_desktop.yml @@ -1,9 +1,9 @@ --- - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: diff --git a/roles/postgresql/examples/install_postgresql16_with_pgadmin.yml b/roles/postgresql/examples/install_postgresql16_with_pgadmin.yml index d4b1bf5..1df17f7 100644 --- a/roles/postgresql/examples/install_postgresql16_with_pgadmin.yml +++ b/roles/postgresql/examples/install_postgresql16_with_pgadmin.yml @@ -1,9 +1,9 @@ --- - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -12,7 +12,7 @@ name: alexanderbazhenoff.linux.postgresql vars: postgresql_version: 16 - install_pgadmin: True + install_pgadmin: true pgadmin_email: a.bazhenov@tm-industries.ru pgadmin_password: Postgresql4Space postgresql_conf: diff --git a/roles/postgresql/examples/uninstall_postgresql16_with_pgadmin.yml b/roles/postgresql/examples/uninstall_postgresql16_with_pgadmin.yml index 900f76b..fda1221 100644 --- a/roles/postgresql/examples/uninstall_postgresql16_with_pgadmin.yml +++ b/roles/postgresql/examples/uninstall_postgresql16_with_pgadmin.yml @@ -1,9 +1,9 @@ --- - hosts: all - become: True + become: true become_method: sudo - gather_facts: True + gather_facts: true tasks: @@ -13,5 +13,5 @@ vars: role_action: uninstall postgresql_version: 16 - install_pgadmin: True - clean_install: True + install_pgadmin: true + clean_install: true diff --git a/roles/postgresql/molecule/default/converge.yml b/roles/postgresql/molecule/default/converge.yml index 29f34f1..679a112 100644 --- a/roles/postgresql/molecule/default/converge.yml +++ b/roles/postgresql/molecule/default/converge.yml @@ -2,7 +2,7 @@ - name: Converge hosts: all - become: True + become: true become_method: sudo tasks: @@ -13,8 +13,8 @@ vars: role_action: install role_subject: server - install_pgadmin: True - debug_mode: True + install_pgadmin: true + debug_mode: true postgresql_additional_packages: - postgresql{% if ansible_os_family == 'Debian' %}-client-{{ postgresql_version }}{% else -%} {{ postgresql_version }}-contrib{% endif %} diff --git a/roles/postgresql/molecule/default/molecule.yml b/roles/postgresql/molecule/default/molecule.yml index 1cd5081..0c4ce5f 100644 --- a/roles/postgresql/molecule/default/molecule.yml +++ b/roles/postgresql/molecule/default/molecule.yml @@ -3,8 +3,8 @@ dependency: name: galaxy options: - ignore-certs: True - ignore-errors: True + ignore-certs: true + ignore-errors: true driver: name: docker platforms: @@ -15,8 +15,8 @@ platforms: buildargs: image_platform: jrei/systemd-debian image_tag: 11 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -33,8 +33,8 @@ platforms: buildargs: image_platform: jrei/systemd-debian image_tag: 12 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -51,8 +51,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 20.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -69,8 +69,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 22.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -87,8 +87,8 @@ platforms: buildargs: image_platform: oraclelinux image_tag: 8 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -104,8 +104,8 @@ platforms: buildargs: image_platform: oraclelinux image_tag: 9 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -121,8 +121,8 @@ platforms: buildargs: image_platform: alpine image_tag: latest - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp diff --git a/roles/postgresql/tasks/add_pgadmin_repo_debian.yml b/roles/postgresql/tasks/add_pgadmin_repo_debian.yml index ab64c00..5fa59d7 100644 --- a/roles/postgresql/tasks/add_pgadmin_repo_debian.yml +++ b/roles/postgresql/tasks/add_pgadmin_repo_debian.yml @@ -5,7 +5,7 @@ url: "{{ pgadmin_apt_key_url }}" dest: /tmp/pgadmin.gpg mode: 0644 - validate_certs: False + validate_certs: false force: True register: pgadmin_apt_key_results until: pgadmin_apt_key_results is succeeded diff --git a/roles/zabbix_agent/README.md b/roles/zabbix_agent/README.md index 149a214..593eb4a 100644 --- a/roles/zabbix_agent/README.md +++ b/roles/zabbix_agent/README.md @@ -53,15 +53,15 @@ Main parameters: | Variable | default | Comment | |-----------------------------|----------------------------------------|------------------------------------------------------------------------| | `zabbix_release` | 5.0 | Zabbix release (not effective for Alpine) | -| `install_v2_agent` | True | Install Zabbix agent v2 when possible, otherwise install v1 | -| `customize_agent` | True | Configure agent for automatic services discovery and templates add | -| `clean_install` | True | Perform clean install (re-install agent with clean-up) | +| `install_v2_agent` | true | Install Zabbix agent v2 when possible, otherwise install v1 | +| `customize_agent` | true | Configure agent for automatic services discovery and templates add | +| `clean_install` | true | Perform clean install (re-install agent with clean-up) | | `conf_with_dir_clean` | True | Configure or perform clean installation with config directory clean-up | | `debug_mode` | True | More outputs | -| `customize_agent_only` | False | Re-configure agent without Zabbix install | +| `customize_agent_only` | false | Re-configure agent without Zabbix install | | `zabbix_repo_url` | http://repo.zabbix.com | Zabbix repo URL | | `archlinux_repo_url_prefix` | https://archive.archlinux.org/packages | Archlinux repo URL prefix | -| `repo_dl_validate_certs` | False | Check certificates on Zabbix repo package download (required on | +| `repo_dl_validate_certs` | false | Check certificates on Zabbix repo package download (required on | | | | outdated virtual machines snapshots) | Zabbix agent settings: @@ -123,7 +123,7 @@ Install and configure Zabbix v1 agent(s): become_method: sudo roles: - role: alexanderbazhenoff.linux.zabbix_agent - install_v2_agent: False + install_v2_agent: false Install and configure Zabbix v2 agent(s): diff --git a/roles/zabbix_agent/defaults/main.yml b/roles/zabbix_agent/defaults/main.yml index a6afdbd..737cfe4 100644 --- a/roles/zabbix_agent/defaults/main.yml +++ b/roles/zabbix_agent/defaults/main.yml @@ -4,22 +4,22 @@ zabbix_release: 5.0 # Install zabbix-agent v2 when possible (v2 is available in zabbix repo for current linux distribution): -install_v2_agent: True +install_v2_agent: true # Customize agent for automatic services discovery and templates add: -customize_agent: True +customize_agent: true # Delete all agents and config before install: -clean_install: True +clean_install: true # Lots of debug outputs: -debug_mode: False +debug_mode: false # Force cleanup zabbix agent directories and files (just to avoid installation/uninstallation scripts bugs): -conf_with_dir_clean: True +conf_with_dir_clean: true # Only customize and configure already installed zabbix agent: -customize_agent_only: False +customize_agent_only: false # Zabbix repo URL: zabbix_repo_url: http://repo.zabbix.com @@ -28,7 +28,7 @@ zabbix_repo_url: http://repo.zabbix.com archlinux_repo_url_prefix: https://archive.archlinux.org/packages # Validate certs when downloading packages (to avoid failure on some outdated virtual machines snapshots): -repo_dl_validate_certs: False +repo_dl_validate_certs: false # Parameters for zabbix agent settings zabbix_agent_conf_name: zabbix_agentd diff --git a/roles/zabbix_agent/examples/install_agent_example.yml b/roles/zabbix_agent/examples/install_agent_example.yml index b5f7191..a32396f 100644 --- a/roles/zabbix_agent/examples/install_agent_example.yml +++ b/roles/zabbix_agent/examples/install_agent_example.yml @@ -3,10 +3,10 @@ # This is an example of zabbix agent default version install - hosts: zabbix_clients - become: True + become: true become_method: sudo roles: - role: alexanderbazhenoff.linux.zabbix_agent - install_v2_agent: True - force_install_agent_v1: False - customize_agent_only: False + install_v2_agent: true + force_install_agent_v1: false + customize_agent_only: false diff --git a/roles/zabbix_agent/handlers/main.yml b/roles/zabbix_agent/handlers/main.yml index 9e7e0d9..d72be3f 100644 --- a/roles/zabbix_agent/handlers/main.yml +++ b/roles/zabbix_agent/handlers/main.yml @@ -13,7 +13,7 @@ ansible.builtin.sysvinit: name: "{{ zabbix_agent_daemon_name }}" state: restarted - enabled: True + enabled: true when: (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int < 12) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int < 9) or (ansible_os_family == "RedHat" and ansible_distribution_major_version | int < 6) diff --git a/roles/zabbix_agent/molecule/default/converge.yml b/roles/zabbix_agent/molecule/default/converge.yml index f0cc1f8..1caa5fd 100644 --- a/roles/zabbix_agent/molecule/default/converge.yml +++ b/roles/zabbix_agent/molecule/default/converge.yml @@ -2,7 +2,7 @@ - name: Converge hosts: all - become: True + become: true become_method: sudo tasks: @@ -17,4 +17,4 @@ {% if (ansible_distribution == "Debian" and ansible_distribution_major_version | int >= 12) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int >= 22) %}6.0{% else -%} 5.0{% endif %} - clean_install: False + clean_install: false diff --git a/roles/zabbix_agent/molecule/default/molecule.yml b/roles/zabbix_agent/molecule/default/molecule.yml index 7f00276..d7daf91 100644 --- a/roles/zabbix_agent/molecule/default/molecule.yml +++ b/roles/zabbix_agent/molecule/default/molecule.yml @@ -3,8 +3,8 @@ dependency: name: galaxy options: - ignore-certs: True - ignore-errors: True + ignore-certs: true + ignore-errors: true driver: name: docker platforms: @@ -17,8 +17,8 @@ platforms: # buildargs: # image_platform: jrei/systemd-debian # image_tag: 11 -# pre_build_image: False -# privileged: True +# pre_build_image: false +# privileged: true # tmpfs: # - /run # - /tmp @@ -35,8 +35,8 @@ platforms: # buildargs: # image_platform: jrei/systemd-debian # image_tag: 12 -# pre_build_image: False -# privileged: True +# pre_build_image: false +# privileged: true # tmpfs: # - /run # - /tmp @@ -53,8 +53,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 16.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -71,8 +71,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 18.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -89,8 +89,8 @@ platforms: buildargs: image_platform: jrei/systemd-ubuntu image_tag: 20.04 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -108,8 +108,8 @@ platforms: # buildargs: # image_platform: jrei/systemd-ubuntu # image_tag: 22.04 -# pre_build_image: False -# privileged: True +# pre_build_image: false +# privileged: true # tmpfs: # - /run # - /tmp @@ -127,8 +127,8 @@ platforms: # buildargs: # image_platform: oraclelinux # image_tag: 8 -# pre_build_image: False -# privileged: True +# pre_build_image: false +# privileged: true # tmpfs: # - /run # - /tmp @@ -144,8 +144,8 @@ platforms: buildargs: image_platform: oraclelinux image_tag: 9 - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp @@ -161,8 +161,8 @@ platforms: buildargs: image_platform: alpine image_tag: latest - pre_build_image: False - privileged: True + pre_build_image: false + privileged: true tmpfs: - /run - /tmp diff --git a/roles/zabbix_agent/molecule/default/side_effect.yml b/roles/zabbix_agent/molecule/default/side_effect.yml index dc86f48..0568fe0 100644 --- a/roles/zabbix_agent/molecule/default/side_effect.yml +++ b/roles/zabbix_agent/molecule/default/side_effect.yml @@ -2,7 +2,7 @@ - name: Side effect hosts: all - become: True + become: true become_method: sudo tasks: @@ -17,7 +17,7 @@ {% if (ansible_distribution == "Debian" and ansible_distribution_major_version | int >= 12) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version | int >= 22) %}6.0{% else -%} 5.0{% endif %} - install_v2_agent: False + install_v2_agent: false - name: "default >>> side effect | Check there is no zabbix_agent2, but zabbix_agent process is running" ansible.builtin.shell: "{{ item }}" # noqa command-instead-of-shell @@ -26,6 +26,6 @@ - ps aux | grep "zabbix_agent" | grep -v "grep" args: executable: /bin/bash - changed_when: False + changed_when: false register: zabbix_agent2_found failed_when: zabbix_agent2_found | trim | length == 0 \ No newline at end of file diff --git a/roles/zabbix_agent/molecule/default/verify.yml b/roles/zabbix_agent/molecule/default/verify.yml index 0ea0699..a5c6815 100644 --- a/roles/zabbix_agent/molecule/default/verify.yml +++ b/roles/zabbix_agent/molecule/default/verify.yml @@ -2,8 +2,8 @@ - name: Verify hosts: all - gather_facts: True - become: True + gather_facts: true + become: true become_method: sudo tasks: @@ -119,7 +119,7 @@ args: executable: /bin/bash register: zbx_agent_openrc_results - changed_when: False + changed_when: false - name: "| Ensure that zabbix-agent2 status is 'running'" ansible.builtin.assert: @@ -167,11 +167,11 @@ with_items: - { key: "Include", value: "{{ zbx_agent_config_subdirectory_found.files[0].path }}/*.conf" } - { key: "AllowKey", value: "system.run[*]" } - check_mode: True + check_mode: true register: item_presence failed_when: item_presence.changed - name: "default >>> verify | Check host metadata tag line in zabbix agent configs" ansible.builtin.command: cmd: grep "UserParameter=hostmetadata,echo 'Linux" {{ zbx_agent_config_found.files[0].path }} - changed_when: False \ No newline at end of file + changed_when: false \ No newline at end of file diff --git a/roles/zabbix_agent/tasks/reconfigure_zabbix_agent.yml b/roles/zabbix_agent/tasks/reconfigure_zabbix_agent.yml index 12fe312..31e1155 100644 --- a/roles/zabbix_agent/tasks/reconfigure_zabbix_agent.yml +++ b/roles/zabbix_agent/tasks/reconfigure_zabbix_agent.yml @@ -65,19 +65,19 @@ - name: "reconfigure zabbix agents | Set selinux permissive for zabbix_agent_t (Redhat)" selinux_permissive: name: zabbix_agent_t - permissive: True + permissive: true when: ansible_selinux is defined and ansible_selinux and ansible_selinux.status == 'enabled' and ansible_os_family == "RedHat" and ansible_distribution_major_version | int >= 7 - name: "reconfigure zabbix agents | Set selinux booleans to allow zabbix user networking and sudo (Redhat)" ansible.builtin.seboolean: name: "{{ item }}" - state: True - persistent: True + state: true + persistent: true with_items: - zabbix_can_network - zabbix_run_sudo - ignore_errors: True # noqa ignore-errors + ignore_errors: true # noqa ignore-errors when: ansible_selinux is defined and ansible_selinux and ansible_selinux.status == 'enabled' and ansible_os_family == "RedHat" and ansible_distribution_major_version | int >= 7 @@ -221,7 +221,7 @@ args: executable: /bin/bash register: services_hashes - changed_when: False + changed_when: false with_items: - "{{ services_enabled.results }}" when: item.changed @@ -255,7 +255,7 @@ args: executable: /bin/bash register: detected_zabbix_release - changed_when: False + changed_when: false - name: "reconfigure zabbix agents | Zabbix release debug" ansible.builtin.debug: @@ -295,7 +295,7 @@ args: executable: /bin/sh register: grep_allow_root_line_results - changed_when: False + changed_when: false - name: "reconfigure zabbix agents | Change AllowRoot parameter in config (if exists)" ansible.builtin.lineinfile: @@ -303,7 +303,7 @@ regexp: "{{ item.var }}=" line: "{{ item.var }}={{ item.value }}" insertafter: "{{ item.insert_after }}" - backrefs: True + backrefs: true with_items: - { var: "AllowRoot", insert_after: "# AllowRoot=0", value: "1" } notify: