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

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

Feature Request Rename fortios_firewall_service_custom #229

Closed Snickers1337 closed 3 months ago

Snickers1337 commented 1 year ago

Hello together,

is it possible to append a Rename option to this module. I know that there is a way to do this by the API.

This is an examplo of a Rename Request by the API:

method : "PUT"
url : "/api/v2/cmdb/firewall.service/custom/SAMBA"
params : 
vdom : "root"
data : 
color : "0"
name : "SAMBA1"

Also Chat GPT told me an Example for a Task how to do this in ansible, i think the adom Parameter is not necessary:

- name: Rename custom service on FortiGate
  hosts: fortigate
  gather_facts: no
  vars:
    service_name: <SERVICE_NAME>
    new_service_name: <NEW_SERVICE_NAME>
  tasks:
    - name: Rename service
      fortios_firewall_service_custom:
        adom: <ADOM>
        state: present
        update: yes
        name: "{{ service_name }}"
        new_name: "{{ new_service_name }}"
      register: output

    - name: Print output
      debug:
        var: output

Thanks Snickers

MaxxLiu22 commented 1 year ago

@Snickers1337 ,

Thank you for raising this issue, Ansible also use argument name as a mkey in URL to locate object, that is the reason why Ansible can't achieve name edit function, but I have reported it to the development team, and we will consider the solution that Chatgpt provide, Thank you both for providing the information.

Thanks, Maxx