Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new secondary ip instead of replacing #341

Open
Tiguespa opened this issue Aug 5, 2024 · 2 comments
Open

Adding new secondary ip instead of replacing #341

Tiguespa opened this issue Aug 5, 2024 · 2 comments

Comments

@Tiguespa
Copy link

Tiguespa commented Aug 5, 2024

Hello

I've noticed that if i want to implement a new secondary ip via playbook and the module system_interface, it will always change by the new one instead of adding .

Is there anything that i can do to just add ?

tasks:
- name: Enable secondary IP on interface port
fortinet.fortios.fortios_system_interface:
state: "present"
system_interface:
name: "port..."
secondary_IP: "enable"
secondaryip:
-
ip: "..."
id: "..."

Thanks

@MaxxLiu22
Copy link

Hi @Tiguespa ,

Thank you for your question. Our Ansible module is designed to manage the entire object and ensure consistency between scripts and actual configurations. However, we do offer a member operation feature that allows for adding or deleting elements from an existing block. Please find an example below. Do let us know if this does not meet your requirements.

  tasks:
  - name: Configure interfaces.
    fortios_system_interface:
      vdom: root
      state: present
      member_state: present  # present for adding and updating, absent for deleting
      member_path: secondaryip:id # main key for locating the element
      system_interface:
        vdom: root
        allowaccess:
        - ping
        - ssh
        - https
        ip: 1.2.56.4/24
        name: test234
        type: vlan
        secondary_IP: "enable"
        vlanid: 766
        interface: port2
        secondaryip:
          -
            ip: "2.3.4.6/24"
            id: "2"

Thanks,
Maxx

@Tiguespa
Copy link
Author

Tiguespa commented Aug 7, 2024

Thanks you Maxx, it seems it does exactly what i wanted !

I didn't understand member_state/path allowed to do that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants