Fix tripleo_network config conditional

The conditional used in the NetworkConfig block always
evaluates to conclude that network config should be
applied.

Use | int filter on the slurped os-net-config return
code file so that the condition does not always evaluate
to False.

Since the molecule test is'nt working, also change it
to use the delegate driver. Create a dummy0 interface, and
change the IP addresses used to the 203.0.113.0/24
TEST-NET-3[1] range to avoid conflicts.

[1] https://tools.ietf.org/html/rfc5737

Closes-Bug: #1918372
Change-Id: Ia4d663cd298556c8143eab6e799e68c81bc8235e
This commit is contained in:
Harald Jensås 2021-03-10 05:27:52 +01:00
parent e22bfd5f47
commit c2aeccc01c
4 changed files with 35 additions and 35 deletions

View File

@ -23,36 +23,36 @@
tripleo_network_config_manage_service: false tripleo_network_config_manage_service: false
tripleo_network_config_hide_sensitive_logs: false tripleo_network_config_hide_sensitive_logs: false
local_mtu: 1500 local_mtu: 1500
ctlplane_ip: 192.168.24.1 ctlplane_ip: 203.0.113.1
ctlplane_subnet_cidr: 24 ctlplane_subnet_cidr: 24
ctlplane_host_routes: [] ctlplane_host_routes: []
ctlplane_dns_nameservers: [] ctlplane_dns_nameservers: []
dns_search_domains: [] dns_search_domains: []
neutron_public_interface_name: tap0 neutron_public_interface_name: dummy0
deployed_server_port_map: deployed_server_port_map:
control_virtual_ip: control_virtual_ip:
fixed_ips: fixed_ips:
- ip_address: 192.168.24.3 - ip_address: 203.0.113.3
network: network:
tags: tags:
- 192.168.24.0/24 - 203.0.113.0/24
subnets: subnets:
- cidr: 192.168.24.0/24 - cidr: 203.0.113.0/24
public_virtual_ip: public_virtual_ip:
fixed_ips: fixed_ips:
- ip_address: 192.168.24.1 - ip_address: 203.0.113.1
network: network:
tags: tags:
- 192.168.24.0/24 - 203.0.113.0/24
subnets: subnets:
- cidr: 192.168.24.0/24 - cidr: 203.0.113.0/24
standalone-ctlplane: standalone-ctlplane:
fixed_ips: fixed_ips:
- ip_address: 192.168.24.1 - ip_address: 203.0.113.1
network: network:
tags: tags:
- 192.168.24.0/24 - 203.0.113.0/24
subnets: subnets:
- cidr: 192.168.24.0/24 - cidr: 203.0.113.0/24
roles: roles:
- role: "tripleo_network_config" - role: "tripleo_network_config"

View File

@ -1,48 +1,44 @@
--- ---
driver: driver:
name: podman name: delegated
options:
managed: false
login_cmd_template: >-
ssh
-o UserKnownHostsFile=/dev/null
-o StrictHostKeyChecking=no
-o Compression=no
-o TCPKeepAlive=yes
-o VerifyHostKeyDNS=no
-o ForwardX11=no
-o ForwardAgent=no
{instance}
ansible_connection_options:
ansible_connection: ssh
log: true log: true
platforms: platforms:
- name: ubi8 - name: instance
hostname: ubi8
image: ubi8/ubi:8.2
registry:
url: registry.access.redhat.com
dockerfile: Dockerfile
pkg_extras: python*setuptools
volumes:
- /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
privileged: true
environment: &env
http_proxy: "{{ lookup('env', 'http_proxy') }}"
https_proxy: "{{ lookup('env', 'https_proxy') }}"
ulimits: &ulimit
- host
provisioner: provisioner:
inventory: inventory:
hosts: hosts:
all: all:
hosts: hosts:
ubi8: instance:
ansible_python_interpreter: /usr/bin/python3 ansible_host: localhost
name: ansible name: ansible
log: true log: true
env: env:
ANSIBLE_STDOUT_CALLBACK: yaml ANSIBLE_STDOUT_CALLBACK: yaml
ANSIBLE_ROLES_PATH: "${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
scenario: scenario:
test_sequence: test_sequence:
- destroy
- create
- prepare - prepare
- converge - converge
- check - check
- destroy
verifier: verifier:
name: testinfra name: testinfra

View File

@ -23,8 +23,12 @@
vars: vars:
test_deps_setup_tripleo: true test_deps_setup_tripleo: true
- name: Ensure legacy scripts installed - name: Ensure legacy scripts installed
become: true
package: package:
name: network-scripts name: network-scripts
state: present state: present
when: when:
- ansible_facts['distribution_major_version'] is version('8', '==') - ansible_facts['distribution_major_version'] is version('8', '==')
- name: Create a dummy network interface
become: true
command: "ip link add dummy0 type dummy"

View File

@ -101,5 +101,5 @@
- (tripleo_network_config_action == "CREATE") or - (tripleo_network_config_action == "CREATE") or
("UPDATE" in tripleo_network_config_network_deployment_actions) or ("UPDATE" in tripleo_network_config_network_deployment_actions) or
(os_net_config_returncode_stat.stat.exists and (os_net_config_returncode_stat.stat.exists and
((os_net_config_returncode_slurp.content | b64decode) != 0)) or ((os_net_config_returncode_slurp.content | b64decode | int) != 0)) or
(not os_net_config_returncode_stat.stat.exists) (not os_net_config_returncode_stat.stat.exists)