Browse Source

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
changes/49/779649/3
Harald Jensås 5 months ago
parent
commit
c2aeccc01c
  1. 22
      tripleo_ansible/roles/tripleo_network_config/molecule/default/converge.yml
  2. 42
      tripleo_ansible/roles/tripleo_network_config/molecule/default/molecule.yml
  3. 4
      tripleo_ansible/roles/tripleo_network_config/molecule/default/prepare.yml
  4. 2
      tripleo_ansible/roles/tripleo_network_config/tasks/main.yml

22
tripleo_ansible/roles/tripleo_network_config/molecule/default/converge.yml

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

42
tripleo_ansible/roles/tripleo_network_config/molecule/default/molecule.yml

@ -1,48 +1,44 @@
---
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
platforms:
- name: ubi8
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
- name: instance
provisioner:
inventory:
hosts:
all:
hosts:
ubi8:
ansible_python_interpreter: /usr/bin/python3
instance:
ansible_host: localhost
name: ansible
log: true
env:
ANSIBLE_STDOUT_CALLBACK: yaml
ANSIBLE_ROLES_PATH: "${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
scenario:
test_sequence:
- destroy
- create
- prepare
- converge
- check
- destroy
verifier:
name: testinfra

4
tripleo_ansible/roles/tripleo_network_config/molecule/default/prepare.yml

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

2
tripleo_ansible/roles/tripleo_network_config/tasks/main.yml

@ -101,5 +101,5 @@
- (tripleo_network_config_action == "CREATE") or
("UPDATE" in tripleo_network_config_network_deployment_actions) or
(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)
Loading…
Cancel
Save