Closed Snickers1337 closed 1 year ago
Hi @Snickers1337 ,
Thank you for your question, here is an example for your reference. But the error says you fail connecting to FGT, which may caused by not providing a valid IP address or don't have permission to access FGT, for latter reason please check if you use a valid "access_token", and give full permission to that API user. Please let me know if you still have questions.
- hosts: fortigates
collections:
- fortinet.fortios
connection: httpapi
vars:
vdom: root
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false
ansible_httpapi_port: 443
tasks:
- name: Configure service groups.
fortios_firewall_service_group:
vdom: root
state: present
access_token: 3jGnNqbsdfww47btqw1H5rr7d78dcN
firewall_service_group:
color: '3'
comment: Comment.
member:
- name: IMAP
- name: DNS
- name: HTTP
name: ansible_Test
Thanks, Maxx
Hello Maxx,
Thanks again for your fast and axcellent help. You solved my problem.
There was a problem in my Access Token.
Thanks Snickers
Hello,
I tried to add Firewall service groups, but cannot use this feature because i always get errors. I tried many diffrent ways, so i dont know if it is a Problem by the module or if it is a Syntax error. I checked different things many times and if i look at the ansible docs example of this module i cannot find any problem with my syntax. https://docs.ansible.com/ansible/latest/collections/fortinet/fortios/fortios_firewall_service_group_module.html
I also checked the result of some custom service group objects by using the get fact module. The result tells me that the correct member format is somethin like this:
The Web Application API tool also tells me that the format of the members attribute has to look like this:
I outsourced some parameters into another files, this worked for me with other modules like create custom service object. outsourced parameters:
My Syntax:
alternative Syntax:
also i Tested different ways at the "member" parameter but after my research i think one of these or both has to be correct.
The error i get looks like this:
Please can anyone post a working example of this module? Or tell me my Mistake? Possibly is there a Problem in the Module?
My environment: