Fix linters and metadata

With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: I74cefdfa885fa26dd7199fd0798527f511bf329d
This commit is contained in:
Dmitriy Rabotyagov 2023-07-12 16:07:09 +02:00
parent 2d0e465fd3
commit 8ae6540d0b
9 changed files with 47 additions and 37 deletions

View File

@ -18,7 +18,7 @@ debug: False
## Cap the maximum number of threads / workers when a user value is unspecified.
repo_nginx_threads_max: 16
repo_nginx_threads: "{{ [[ansible_facts['processor_vcpus']|default(2) // 2, 1] | max, repo_nginx_threads_max] | min }}"
repo_nginx_threads: "{{ [[ansible_facts['processor_vcpus'] | default(2) // 2, 1] | max, repo_nginx_threads_max] | min }}"
## APT Cache Options
cache_timeout: 600
@ -53,12 +53,12 @@ repo_server_systemd_mounts: []
# Example using remote shared filesystem to synchronise the repo contents between
# several repo servers
#repo_server_systemd_mounts:
# - what: "gluster-server:gluster-volume-name"
# where: "/var/www/repo"
# type: glusterfs
# state: 'started'
# enabled: true
# repo_server_systemd_mounts:
# - what: "gluster-server:gluster-volume-name"
# where: "/var/www/repo"
# type: glusterfs
# state: 'started'
# enabled: true
###
### Backend TLS
@ -113,6 +113,6 @@ repo_pki_install_certificates:
condition: "{{ repo_user_ssl_ca_cert is defined }}"
# Define user-provided SSL certificates
#repo_user_ssl_cert: <path to cert on ansible deployment host>
#repo_user_ssl_key: <path to cert on ansible deployment host>
#repo_user_ssl_ca_cert: <path to cert on ansible deployment host>
# repo_user_ssl_cert: <path to cert on ansible deployment host>
# repo_user_ssl_key: <path to cert on ansible deployment host>
# repo_user_ssl_ca_cert: <path to cert on ansible deployment host>

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: reload nginx
- name: Reload nginx
service:
name: "nginx"
enabled: yes

View File

@ -18,19 +18,21 @@ galaxy_info:
description: Install package repo server
company: Rackspace
license: Apache2
min_ansible_version: 2.2
role_name: repo_server
namespace: openstack
min_ansible_version: "2.10"
platforms:
- name: Debian
versions:
- buster
- bullseye
- name: Ubuntu
versions:
- bionic
- focal
- jammy
- name: EL
versions:
- 8
categories:
- "9"
galaxy_tags:
- cloud
- python
- development

View File

@ -30,15 +30,18 @@
- always
# TODO (jrosser) Remove this task for the Z release
- ansible.builtin.include_tasks: repo_sync_cleanup.yml
- name: Including repo_sync_cleanup tasks
ansible.builtin.include_tasks: repo_sync_cleanup.yml
tags:
- repo_server-install
- ansible.builtin.include_tasks: repo_pre_install.yml
- name: Including repo_pre_install tasks
ansible.builtin.include_tasks: repo_pre_install.yml
tags:
- repo_server-install
- ansible.builtin.include_tasks: repo_install.yml
- name: Including repo_install tasks
ansible.builtin.include_tasks: repo_install.yml
tags:
- repo_server-install
@ -62,7 +65,8 @@
tags:
- always
- ansible.builtin.include_tasks: repo_post_install.yml
- name: Including repo_post_install tasks
ansible.builtin.include_tasks: repo_post_install.yml
tags:
- repo_server-config
@ -72,7 +76,8 @@
path: "{{ repo_service_home_folder }}/.ssh/authorized_keys"
state: absent
- ansible.builtin.include_tasks: repo_install_constraints.yml
- name: Including repo_install_constraints tasks
ansible.builtin.include_tasks: repo_install_constraints.yml
when: inventory_hostname == groups['repo_all'][0]
tags: repo_server-config

View File

@ -23,8 +23,7 @@
- name: Clean yum metadata when nginx repo is removed
command: dnf clean metadata
args:
warn: no
changed_when: false
when:
- ansible_facts['pkg_mgr'] == 'dnf'
- _repo_removed is changed

View File

@ -17,6 +17,7 @@
file:
state: directory
path: "{{ repo_upper_constraints_path }}"
mode: "0755"
delegate_to: localhost
# by default the u-c file is retrieved by https
@ -24,12 +25,13 @@
get_url:
url: "{{ user_requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}"
dest: "{{ repo_upper_constraints_path }}/{{ 'upper_constraints_' ~ requirements_git_install_branch | default('master') ~ '.txt' }}"
mode: "0644"
when: requirements_git_repo is search('http')
delegate_to: localhost
- name: Retrieve local filesystem upper constraints in CI
command:
git --git-dir={{ requirements_git_repo.split('file://')[1] }}/.git show {{ requirements_git_install_branch | default('master') }}:upper-constraints.txt
git --git-dir={{ requirements_git_repo.split('file://')[1] }}/.git show {{ requirements_git_install_branch | default('master') }}:upper-constraints.txt
when: requirements_git_repo is search('file://')
register: _uc_contents_git
delegate_to: localhost
@ -40,6 +42,7 @@
copy:
content: "{{ _uc_contents_git.stdout }}"
dest: "{{ repo_upper_constraints_path }}/{{ 'upper_constraints_' ~ requirements_git_install_branch | default('master') ~ '.txt' }}"
mode: "0644"
when: requirements_git_repo is search('file://')
delegate_to: localhost
@ -49,7 +52,7 @@
dest: "{{ repo_service_home_folder }}/repo/constraints/"
owner: "{{ repo_service_user_name }}"
group: "{{ repo_service_group_name }}"
mode: 0644
mode: "0644"
- name: Create a symlink for constraints file
file:
@ -58,4 +61,4 @@
owner: "{{ repo_service_user_name }}"
group: "{{ repo_service_group_name }}"
state: link
mode: 0644
mode: "0644"

View File

@ -23,22 +23,24 @@
file:
path: "{{ item.path }}"
state: "{{ item.state | default('absent') }}"
mode: "0644"
with_items:
- path: "/etc/nginx/sites-enabled/default"
notify:
- reload nginx
- Reload nginx
- name: Drop NGINX configuration files
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "0644"
with_items:
- src: "nginx.conf.j2"
dest: "/etc/nginx/nginx.conf"
- src: "openstack-slushee.vhost.j2"
dest: "/etc/nginx/sites-available/openstack-slushee.vhost"
notify:
- reload nginx
- Reload nginx
- name: Enable openstack-slushee site
file:
@ -46,4 +48,4 @@
dest: "/etc/nginx/sites-enabled/openstack-slushee.vhost"
state: "link"
notify:
- reload nginx
- Reload nginx

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: create the system group
- name: Create the system group
group:
name: "{{ repo_service_group_name }}"
state: "present"
@ -30,13 +30,13 @@
home: "{{ repo_service_home_folder }}"
# NOTE(jrosser) remove this task in release after Z
- name: Test if {{ repo_service_home_folder }}/repo exists
- name: Test if {{ repo_service_home_folder }}/repo exists # noqa: name[template]
stat:
path: "{{ repo_service_home_folder }}/repo"
register: _repo_folder_stat
# NOTE(jrosser) remove this task in release after Z
- name: Test if {{ repo_service_home_folder }} is a mountpoint
- name: Test if a path is a mountpoint {{ repo_service_home_folder }}
command: mountpoint -q {{ repo_service_home_folder }}/repo
register: _repo_folder_mountpoint
failed_when: False
@ -62,14 +62,15 @@
- skip_ansible_lint
# NOTE(jrosser) remove this task in release after Z
- file:
- name: Remove folder dir during migration from lsyncd
file:
path: "{{ repo_service_home_folder }}/repo"
state: absent
when:
- _repo_folder_stat.stat.exists
- _repo_folder_mountpoint.rc != 0
notify:
- reload nginx
- Reload nginx
- name: Mount any remote volumes
include_role:
@ -79,7 +80,7 @@
when: repo_server_systemd_mounts | length > 0
# NOTE(jrosser) ensure there is no race condition between mounting and using the filesystem
- name: Wait until {{ repo_service_home_folder }} is a mounted
- name: Wait until mount will finish for {{ repo_service_home_folder }}
command: mountpoint -q {{ repo_service_home_folder }}/repo
changed_when: false
register: _repo_folder_is_mounted

View File

@ -57,5 +57,3 @@
file:
path: "{{ repo_service_home_folder }}/.ssh"
state: absent