Set the ansible-lint version to v5.3.2

The ansible-lint version used is v5.0.2. This path increases the version
of the ansible-lint on the .pre-commit-config.yaml

It also includes cherry-pick of https://review.opendev.org/c/openstack/tripleo-ansible/+/779180
```
Upgrade ansible-lint to 5.0

- remove role name rule as is included in newer versions
- added .cache folder to git ignore (used by linter)
- enabled optional yamllint run on ansible-lint
- assured repository has a valid root requirements.yml (so linter can make use of it)
- assured that we do not mix playbooks with non playbooks inside same folders
- renamed undocumented "role" argument received by import_role to official "name".
- added mocked roles/modules to avoid linter errors (ideally they should be provided by
  requiremetns.yml).
```
requirements.yml is removed from this cherry-pick as it is not needed
here.

Use centos8 image to fix following issue
```
file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release from install of containers-common-2:1-6.module_el8.6.0+954+963caf36.noarch conflicts with file from package redhat-release-8.2-1.0.el8.x86_64
```
Pin to container-tools:3.0 will fix the issue.

Change-Id: I14b855f8a15afccaf4973e2a612aa7e9eae3bfa5
(cherry picked from commit af40f9ff8e)

Related-bug: #1956902
Change-Id: I36e1327a2cc3c66ef4662b473e0fd03fe97cccf6
(cherry picked from commit 60ef62e9f2)
Signed-off-by: Ananya <anbanerj@redhat.com>
Co-authored-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
This commit is contained in:
Sorin Sbarnea 2021-01-13 17:11:03 +00:00 committed by Chandan Kumar (raukadah)
parent 6fc91a9657
commit 549545e782
27 changed files with 86 additions and 264 deletions

View File

@ -1,7 +1,65 @@
exclude_paths:
- releasenotes/
- tripleo_ansible/ansible_plugins/tests/molecule/tripleo_dnf_stream/converge.yml
- tripleo_ansible/playbooks/cli-overcloud-backup.yaml
parseable: true
quiet: false
rulesdir:
- .ansible-lint_rules/
verbosity: 1
# Mocking modules is not recommended as it prevents testing of invalid
# arguments or lack of their presence at runtime. It is preffered to
# make use of requirements.yml to declare them.
mock_roles:
- ceph-defaults
- ceph-facts
- openstack-operations
mock_modules:
- baremetal_nodes_validate
- baremetal_register_or_update_nodes
- ceph_key
- ceph_pool
- config_template
- container_startup_config
- lvm2_physical_devices_facts
- metalsmith_instances
- os_baremetal_clean_node
- os_baremetal_provide_node
- os_tripleo_baremetal_configure
- os_tripleo_baremetal_node_introspection
- podman_container
- podman_container_info
- podman_volume_info
- tripleo_baremetal_check_existing
- tripleo_baremetal_expand_roles
- tripleo_baremetal_populate_environment
- tripleo_build_heat_environment
- tripleo_composable_network
- tripleo_config_download
- tripleo_container_config_scripts
- tripleo_container_configs
- tripleo_container_image_prepare
- tripleo_derive_hci_parameters
- tripleo_diff_exec
- tripleo_fernet_keys_rotate
- tripleo_generate_ansible_inventory
- tripleo_generate_overcloudrc
- tripleo_get_flatten_stack
- tripleo_get_introspected_data
- tripleo_get_role_list
- tripleo_image_params_prepare
- tripleo_iptables
- tripleo_network_populate_environment
- tripleo_network_ports_populate_environment
- tripleo_os_net_config
- tripleo_os_net_config_mappings
- tripleo_overcloud_network_extract
- tripleo_overcloud_network_ports
- tripleo_passwords_rotate
- tripleo_plan_deploy
- tripleo_plan_parameters_update
- tripleo_swift_tempurl
- tripleo_templates_upload
- tripleo_unmanaged_populate_environment
- tripleo_dnf_stream
- openstack.cloud.stack

View File

@ -1,57 +0,0 @@
# Copyright (c) 2020 Gael Chamoulaud <gchamoul@redhat.com>
# Copyright (c) 2020 Sorin Sbarnea <ssbarnea@redhat.com>
#
# 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, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# 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.
import re
from ansiblelint import AnsibleLintRule
ROLE_NAME_REGEX = '^[a-z][a-z0-9_]+$'
class RoleNames(AnsibleLintRule):
id = '710'
shortdesc = (
"Role name {} does not match `%s` pattern" % ROLE_NAME_REGEX
)
description = (
"Role names are now limited to contain only lowercase alphanumeric "
"characters, plus '_' and start with an alpha character. See "
"`developing collections "
"<https://docs.ansible.com/ansible/devel/dev_guide/developing_"
"collections.html#roles-directory>`_"
)
severity = 'HIGH'
done = [] # already noticed roles list
tags = ['metadata']
version_added = 'v4.3.0'
ROLE_NAME_REGEXP = re.compile(ROLE_NAME_REGEX)
def match(self, file, text):
path = file['path'].split("/")
if "roles" in path:
role_name = path[path.index("roles") + 1]
if role_name not in self.done:
self.done.append(role_name)
if not re.match(self.ROLE_NAME_REGEXP, role_name):
return self.shortdesc.format(role_name)
else:
return False
return False

1
.gitignore vendored
View File

@ -38,3 +38,4 @@ doc/build/*
# JetBrain
.idea/
.cache

View File

@ -29,12 +29,13 @@ repos:
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict -f parsable
- repo: https://github.com/ansible/ansible-lint
rev: v4.3.5
- repo: https://github.com/ansible-community/ansible-lint
rev: v5.3.2
hooks:
- id: ansible-lint
additional_dependencies:
- 'ansible<2.10'
- yamllint
- repo: https://github.com/openstack-dev/bashate.git
rev: 2.0.0
hooks:

View File

@ -1,15 +0,0 @@
---
# Copyright 2020 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

0
galaxy.yml Normal file
View File

View File

@ -14,6 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
# DEPRECATED, the official location for dependencies is now
# /requirements.yaml file.
- name: openstack-operations
scm: git
src: https://opendev.org/openstack/ansible-role-openstack-operations

View File

@ -10,7 +10,7 @@
register: container_startup_config_tmp_dir
- name: Generate container startup configs
container_startup_config:
config_data: "{{ lookup('file', playbook_dir + '/container-configs.yml', errors='ignore') | default({}, True) | from_yaml }}"
config_data: "{{ lookup('file', playbook_dir + '/files/container-configs.yml', errors='ignore') | default({}, True) | from_yaml }}"
config_base_dir: "{{ container_startup_config_tmp_dir.path }}"
- name: Check that HAproxy container configuration file was created
stat:

View File

@ -18,7 +18,7 @@
hosts: all
- name: upgrade ceph mdss cluster, deactivate all rank > 0
hosts: "{{ groups[mon_group_name|default('mons')][0] }}"
hosts: "{{ groups[mon_group_name|default('mons')][0]|default([]) }}"
become: true
tasks:
- name: deactivate all mds rank > 0

View File

@ -1,15 +0,0 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,15 +0,0 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,15 +0,0 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,15 +0,0 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,15 +0,0 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,15 +0,0 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,15 +0,0 @@
---
# Copyright 2020 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -5,18 +5,16 @@ driver:
log: true
platforms:
- name: ubi8
hostname: ubi8
image: ubi8/ubi:8.2
registry:
url: registry.access.redhat.com
- name: centos8
hostname: centos8
image: quay.io/centos/centos:stream8
dockerfile: Dockerfile
pkg_extras: python*setuptools
volumes:
- /run/udev:/run/udev:ro
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /lib/modules:/lib/modules
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- /etc/pki/rpm-gpg:/etc/pki/rpm-gpg
- /opt/yum.repos.d:/etc/yum.repos.d:rw
- /etc/dnf/vars:/etc/dnf/vars
privileged: true
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
@ -30,7 +28,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos8:
ansible_python_interpreter: /usr/bin/python3
log: true
env:

View File

@ -20,8 +20,8 @@
roles:
- role: test_deps
vars:
test_deps_setup_tripleo: true
test_deps_setup_stream: false
test_deps_setup_tripleo: false
test_deps_setup_stream: true
post_tasks:
- name: Create paths

View File

@ -1,15 +0,0 @@
---
# Copyright 2020 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -5,18 +5,16 @@ driver:
log: true
platforms:
- name: ubi8
hostname: ubi8
image: ubi8/ubi:8.2
registry:
url: registry.access.redhat.com
- name: centos8
hostname: centos8
image: quay.io/centos/centos:stream8
dockerfile: Dockerfile
pkg_extras: python*setuptools
volumes:
- /run/udev:/run/udev:ro
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /lib/modules:/lib/modules
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
- /etc/pki/rpm-gpg:/etc/pki/rpm-gpg
- /opt/yum.repos.d:/etc/yum.repos.d:rw
- /etc/dnf/vars:/etc/dnf/vars
privileged: true
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
@ -29,7 +27,7 @@ provisioner:
hosts:
all:
hosts:
ubi8:
centos8:
ansible_python_interpreter: /usr/bin/python3
name: ansible
log: true

View File

@ -21,7 +21,7 @@
- include_role:
name: test_deps
vars:
test_deps_setup_tripleo: true
test_deps_setup_stream: false
test_deps_setup_tripleo: false
test_deps_setup_stream: true
test_deps_extra_packages:
- jq

View File

@ -1,15 +0,0 @@
---
# Copyright 2020 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,15 +0,0 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -1,15 +0,0 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

View File

@ -28,7 +28,7 @@
become: true
shell: |
dnf module disable container-tools:rhel8 -y
dnf module enable container-tools:2.0 -y
dnf module enable container-tools:3.0 -y
when:
- (ansible_os_family | lower) == "redhat"
- (ansible_distribution_major_version | int) >= 8