fortinet-ansible-dev / ansible-galaxy-fortios-collection

GNU General Public License v3.0
85 stars 49 forks source link

Feature Request - fortios_router_bgp #183

Closed cardosocristian closed 2 years ago

cardosocristian commented 2 years ago

Hi Would it be possible to insert the present/absent state in the fortios_router_bgp module?

I noticed that since it doesn't validate this, it simply recreates the entire BGP router configuration, deleting anything already pre-existing on the Fortinet in use.

The way in question would be the link: https://ansible-galaxy-fortios-docs.readthedocs.io/en/latest/gen/fortios_router_bgp.html

I detected this, when trying to correct only one BGP information in a pre-existing neighbor, in my equipment there were 4 additional neighbors, after the execution, I noticed that there was only the neighbor that I had modified and the others were deleted.

JieX19 commented 2 years ago

@cardosocristian

The current module already supports 'member operation', which means you can add or delete a member from a group.

Before_config: before_config

Modifications on a member of the group:

  tasks:
  - name: Configure BGP.
    fortios_router_bgp:
      vdom:  "root"
      member_path: neighbor:ip
      member_state: "present"
      access_token: "3w14QbxGq35dt0w4jxH15abcdefg"
      router_bgp:
        neighbor:
         -   
            ip: 1.1.1.3
            local_as: 113
            bfd: enable

After_config: after_config

Member operation has been available in many modules. Hope this helps.

cardosocristian commented 2 years ago

Hi @JieX19 Thanks for the help, I think I understand.