create router step fails on second run
Summary
If one executes a playbook with network
action of this role and wants to create ports, floating IPs, networks and routers and connect these pieces together, the playbook will fail on a second run.
Important note: use ansible 2.7.0
Steps to reproduce
Run this playbook twice:
- hosts: localhost
gather_facts: no
vars:
openstack_cloud: "task-ceph-test"
openstack_project_ports:
- name: "test-port"
network: "test-net"
addresses:
- subnetwork_name: "test-subnet"
security_groups:
- "default"
openstack_project_networks:
- name: "test-net"
subnet_name: "test-subnet"
subnet_cidr: "192.168.1.0/24"
openstack_project_routers:
- name: "test-router"
network: "ext-net-task"
interfaces:
- "test-subnet"
openstack_project_floating_ips:
- name: "test-floating-ip"
network: "ext-net-task"
port: "test-port"
tasks:
- include_role: { name: "openstack", tasks_from: "network" }
Expected behavior
First run creates all pieces, second run changes nothing.
Actual behavior
First run creates all pieces, second run fails.
Relevant logs and/or screenshots
___________________________________
< TASK [openstack : create routers] >
-----------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
failed: [localhost -> localhost] (item=test-router) => {"_openstack_router": {"interfaces": ["test-subnet"], "name": "test-router", "network": "ext-net-task"}, "changed": false, "msg": "Error detaching interface from router d3b6d67d-edfa-4ef5-bb6c-70d34177bcf8"}
Possible fixes
After some testing the problem is connected to this issue and the resolution is to add enable_snat: yes
parameter when creating router using os_router
module.
Edited by Bartłomiej Daca