ansible-collection-cloudstack icon indicating copy to clipboard operation
ansible-collection-cloudstack copied to clipboard

Network offering: set default network offering

Open fprojetto opened this issue 5 years ago • 4 comments

Expected behaviour It should be possible to create a CloudStack network with a default network offering when a zone uses basic networking.

Current behaviour It fails with error: Network offering 'DefaultSharedNetworkOffering' not found

cs_network:
  name: "{{ guest_network_name }}"
  zone: "{{ zone_name }}"
  display_text: "{{ guest_network_name }}"
  network_offering: DefaultSharedNetworkOffering
  state: present

Possible solution

Modify the get_network_offering to get the default network offerings as well as the network offerings specific with the zone, merge the two sets, and final loop over the newly created set of network offerings.

Steps to reproduce

# zone
- name: Ensure the zone is created.
  cs_zone:
    name: "{{ zone_name }}"
    dns1: "{{ dns_external }}"
    internal_dns1: "{{ dns_internal }}"
    network_type: Basic
    state: present

# physical network
- name: Ensure the physical network is created.
  cs_physical_network:
    name: "{{ phy_network_name }}"
    zone: "{{ zone_name }}"
    nsps_enabled:
      - VirtualRouter
    state: present

- name: Ensure traffic type Guest is created.
  cs_traffic_type:
    physical_network: "{{ phy_network_name }}"
    zone: "{{ zone_name }}"
    traffic_type: Guest
    state: present

- name: Ensure traffic type Management is created.
  cs_traffic_type:
    physical_network: "{{ phy_network_name }}"
    zone: "{{ zone_name }}"
    traffic_type: Management
    state: present

- name: Ensure the physical network is enabled.
  cs_physical_network:
    name: "{{ phy_network_name }}"
    zone: "{{ zone_name }}"
    nsps_enabled:
      - VirtualRouter
    state: enabled

# guest network
- name: Ensure Guest Network is created.
  form3_cs_network:
    name: "{{ guest_network_name }}"
    zone: "{{ zone_name }}"
    display_text: "{{ guest_network_name }}"
    network_offering: DefaultSharedNetworkOffering
    state: present

Environment Running the version of the module provided with ansible 2.9.6. Running CloudStack 4.13.

fprojetto avatar May 28 '20 14:05 fprojetto

Thanks for reporting this issue. Seems you already have a fix in place, may I ask you to make a PR with the fix?

resmo avatar Jun 09 '20 13:06 resmo

Sure. I need to add an integration test for it and I will make a PR.

fprojetto avatar Jun 20 '20 07:06 fprojetto

Hi @FilippoProjetto, if you want to get this in 2.10, the fix should be made before 18th of august.

resmo avatar Aug 10 '20 07:08 resmo

@filippoprojetto anything I can help you with?

resmo avatar Aug 09 '21 06:08 resmo