Fix role issues for Ansible 2.11

Resolve ansible-lint issues in the role.

Move all to Ansible 2.11 testing, since new molecule
works with collections and TripleO will use Ansible 2.11/2.12
for deployment from Wallaby.

Use FQCN for Ansible collections.
Co-Author: Brendan Shephard <bshephar@redhat.com>

Change-Id: I35a94d3d6335a5589a1b4ed6f3c5c599ccc59eda
This commit is contained in:
Brendan Shephard 2021-09-22 03:41:20 +00:00 committed by Sagi Shnaidman
parent 63d70bb457
commit 04944c4e4f
19 changed files with 53 additions and 29 deletions

View File

@ -0,0 +1,11 @@
collections:
- containers.podman
# - community.general
# Until community.general release is out use latest from git
- name: https://github.com/ansible-collections/community.general
type: git
version: main
- community.docker
- ansible.posix
- ansible.netcommon
- openstack.cloud

View File

@ -1 +1 @@
ansible>=2.8, <2.10.0
ansible-core>=2.11,<2.12.0

View File

@ -1,4 +1,5 @@
ansible>=2.8, <2.10.0
ansible-core>=2.11,<2.12.0
docker
molecule>=3.0,<3.1
molecule
molecule-docker
testinfra

View File

@ -7,3 +7,4 @@ pre-commit # MIT
mock>=2.0.0 # BSD
stestr>=2.0.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
yamllint

View File

@ -7,19 +7,20 @@ skipdist = True
[testenv]
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} {opts} {packages}
install_command = pip install {opts} {packages}
passenv = *
sitepackages = True
deps =
-r {toxinidir}/requirements.txt
-r {toxinidir}/ansible-requirements.txt
-r {toxinidir}/test-requirements.txt
commands = stestr run {posargs}
commands =
ansible-galaxy install -fr {toxinidir}/ansible-collections-requirements.yml
stestr run {posargs}
whitelist_externals =
tox
[testenv:molecule]
install_command = pip install {opts} {packages}
setenv =
ANSIBLE_FILTER_PLUGINS={toxinidir}/tripleo_ipa/ansible_plugins/filter
ANSIBLE_LIBRARY={toxinidir}/tripleo_ipa/roles.galaxy/config_template/library:{toxinidir}/tripleo_ipa/ansible_plugins/modules

View File

@ -40,8 +40,8 @@ except ImportError:
from ipalib.install.kinit import kinit_keytab
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.openstack import openstack_full_argument_spec
from ansible.module_utils.openstack import openstack_module_kwargs
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import openstack_full_argument_spec
from ansible_collections.openstack.cloud.plugins.module_utils.openstack import openstack_module_kwargs
ANSIBLE_METADATA = {
'metadata_version': '1.0',

View File

@ -23,29 +23,29 @@
ipa_password: password123
- name: Download FreeIPA Container
docker_image:
community.docker.docker_image:
name: freeipa/freeipa-server:fedora-28
source: pull
- name: Make IPA data dir
file:
ansible.builtin.file:
path: /tmp/ipa-data
state: directory
- name: Toggle SELinux boolean
seboolean:
ansible.posix.seboolean:
name: container_manage_cgroup
state: true
persistent: true
become: true
- name: Remove any old IPA container
docker_container:
community.docker.docker_container:
name: freeipa-server-container
state: absent
- name: Create network
docker_network:
community.docker.docker_network:
name: ipa_network
ipam_config:
- subnet: 172.18.0.0/16
@ -90,4 +90,4 @@
- name: Print ipactl status
debug:
msg: "{{result.stdout}}"
msg: "{{ result.stdout }}"

View File

@ -26,7 +26,7 @@
tasks:
- name: copy requirements file
copy:
src: "{{playbook_dir}}/../../../requirements.txt"
src: "{{ playbook_dir }}/../../../requirements.txt"
dest: /tmp/requirements.txt
- name: install requirements
pip:
@ -271,7 +271,8 @@
vars:
ipa_server_hostname: ipa.example.test
tasks:
- include_role:
- name: Include IPA Cleanup
include_role:
name: tripleo_ipa_cleanup
vars:
tripleo_ipa_hosts_to_delete: ['test-1.example.test']

View File

@ -23,29 +23,29 @@
ipa_password: password123
- name: Download FreeIPA Container
docker_image:
community.docker.docker_image:
name: freeipa/freeipa-server:fedora-28
source: pull
- name: Make IPA data dir
file:
ansible.builtin.file:
path: /tmp/ipa-data
state: directory
- name: Toggle SELinux boolean
seboolean:
ansible.posix.seboolean:
name: container_manage_cgroup
state: true
persistent: true
become: true
- name: Remove any old IPA container
docker_container:
community.docker.docker_container:
name: freeipa-server-container
state: absent
- name: Create network
docker_network:
community.docker.docker_network:
name: ipa_network
ipam_config:
- subnet: 172.18.0.0/16

View File

@ -35,7 +35,8 @@
- name: End play if undercloud is not an ipa client
meta: end_host
when: default_conf_stat.stat.exists == False
when:
- not default_conf_stat.stat.exists
- name: Get realm and host and keytab
set_fact:
@ -48,7 +49,8 @@
- name: End play if the keytab does not exist
meta: end_host
when: ipa_keytab_stat.stat.exists == False
when:
- not ipa_keytab_stat.stat.exists
tasks:
- name: initialize the list of hosts to clean up

View File

@ -42,7 +42,7 @@
set_fact:
ipa_principal: "{{ tripleo_ipa_principal | default(lookup('env', 'IPA_PRINCIPAL')) }}"
ipa_password: "{{ tripleo_ipa_password | default(lookup('env', 'IPA_PASSWORD')) }}"
undercloud_fqdn: "{{ tripleo_undercloud_fqdn | default(lookup('env', 'UNDERCLOUD_FQDN'))}}"
undercloud_fqdn: "{{ tripleo_undercloud_fqdn | default(lookup('env', 'UNDERCLOUD_FQDN')) }}"
- name: set nova service user facts
set_fact:

View File

@ -83,13 +83,15 @@
- hosts: ipaclients
become: true
tasks:
- include_role:
- name: Include ipaclient role
include_role:
name: ipaclient
- hosts: "{{ tripleo_ipa_undercloud_host | default('localhost') }}"
become: true
tasks:
- include_role:
- name: Include create admin roles
include_role:
name: "{{ item }}"
with_first_found:
- "/usr/share/ansible/roles/tripleo_create_admin"

View File

@ -16,6 +16,7 @@
galaxy_info:
namespace: openstack
author: OpenStack
description: TripleO OpenStack Role -- tripleo_ipa_cleanup
company: Red Hat

View File

@ -16,6 +16,7 @@
galaxy_info:
namespace: openstack
author: OpenStack
description: TripleO OpenStack Role -- tripleo_ipa_dns
company: Red Hat

View File

@ -40,7 +40,7 @@
block:
- name: set record type
set_fact:
record_type: "{{ 'A' if record_value| ipv4 else 'AAAA' }}"
record_type: "{{ 'A' if record_value| ansible.netcommon.ipv4 else 'AAAA' }}"
- name: add dns zone
ipa_dnszone:

View File

@ -16,6 +16,7 @@
galaxy_info:
namespace: openstack
author: OpenStack
description: TripleO OpenStack Role -- tripleo_ipa_registration
company: Red Hat

View File

@ -56,7 +56,8 @@
changed_when: false
failed_when: false
- debug: var=host_raw_data
- name: Print debug data
debug: var=host_raw_data
- name: confirm that host is not already registered with current keytab
when: '"has_keytab: TRUE" not in host_raw_data.stdout'

View File

@ -16,6 +16,7 @@
galaxy_info:
namespace: openstack
author: OpenStack
description: TripleO-IPA Role -- tripleo_ipa_setup
company: Red Hat

View File

@ -2,7 +2,7 @@
- job:
description: tripleo-ipa molecule job
name: tripleo-ipa-centos-8-molecule
nodeset: centos-8
nodeset: centos-8-stream
parent: base
success-url: "reports.html"
failure-url: "reports.html"