Comments (7)
Thanks for your question! At this moment, the backend API is defined this way and it would be backwards incompatible change to switch from taking a list of objects to a list of strings. I will bring up this improvement internally.
from ansible-galaxy-fortios-collection.
@JieX19 Thanks for the reply! What you mean is that the API structure (fortiosapi) on Fortigate is written like that? For the well-working "fortios_ipv4_policy" module to accept a list of strings, are you aware what kind of API is being used by Fortigate? I'm still new to these automation stuff. The source code seems to be using the fortios python module. To accept a list of strings will be truly helpful when we have a large number of entries in a csv spreadsheet to be pushed to Fortigate :)
from ansible-galaxy-fortios-collection.
It's true the python module is triggered while processing the YAMLs, but it's actually the backend APIs to do the CRUD operations. Fortiosapi communicates with fortigate devices through the http-based APIs, which are shared by both the both fortigate UI and ansible modules.
from ansible-galaxy-fortios-collection.
@JieX19 Is it possible that what I requested can be modified shortly by accepting a list of strings? Otherwise to achieve real automation with csv input file, these httpapi based ansible modules can't be used actually. From client's side, it's quite common and user-friendly to prepare all inputs in a csv file first and then loaded to a playbook. A list of strings can't be avoided.
If it is possible, normally how long does it take to modify the API? Thanks.
from ansible-galaxy-fortios-collection.
hello @ricewu2020 ,
we realized it's very hard for API team to modify current logic basing on our requirement.
we decide to work this issue around by processing input content ourselves.
could you try Ansible native data processing methods:
here is an example of mine:
$cat fortios_firewall_addrgrp.yml
- hosts: fortigate03
connection: httpapi
collections:
- fortinet.fortios
vars:
vdom: "root"
ansible_httpapi_use_ssl: no
ansible_httpapi_validate_certs: no
ansible_httpapi_port: 80
#demo_input_path: './my_datasource'
#demo_input: "{{ lookup( 'file', demo_input_path) }}"
demo_input: 'login.microsoftonline.com, login.microsoft.com, login.windows.net'
demo_members: []
tasks:
- name: 'process input content'
set_fact:
demo_members: "{{ demo_members + [{'name': item.strip(' ')}] }}"
with_items:
- "{{demo_input.split(',')}}"
- debug:
var: demo_members
- name: Configure Firewall Schedule Recurring
fortios_firewall_addrgrp:
vdom: "{{ vdom }}"
state: "present"
firewall_addrgrp:
name: "firwalladdressgroup0"
comment: 'created via Ansible'
visibility: 'enable'
member: "{{ demo_members }}"
from ansible-galaxy-fortios-collection.
Ansible playbook is flexible enough to process data in all ways.
the syntax here is much like python/jinja2, so using python's native library is supposed to be ok.
from ansible-galaxy-fortios-collection.
@ricewu2020 hope you are doing fine and getting this issue resolved.
I mark this issue closed. you can feel free to reopen if you need further support from us.
thanks,
Link.
from ansible-galaxy-fortios-collection.
Related Issues (20)
- Can not set Admin SSH keys. "Error in Repo" HOT 4
- "Error in repo" using fortios_firewall_policy module HOT 4
- config system globals timezone not numeric in 7.4.2 HOT 3
- How to Create SDWAN Zone HOT 11
- Changing admin user password results in 403 PUT error. HOT 1
- network os fortinet.fortios.fortios is not supported HOT 1
- Is global scope security profile supported? HOT 1
- fortinet.fortios.fortios_monitor_fact filter questions HOT 4
- fortinet.fortios.fortios_monitor -selector upgrade.system.firmware possible issue? HOT 3
- Need help w/playbook to list all managed fortiap's per firewall. HOT 4
- updating policy based routing of fortigate is not working always has seq-num error HOT 2
- There must be at least 1 server certificate configured HOT 2
- Getting 404 error while trying to add IPv6 address group using fortios_firewall_addrgrp6 HOT 2
- Error in comparison/serialize HOT 4
- Question on usage - setting dhcp (v4) reservations HOT 3
- federated-upgrade 7.2.7>7.2.8 problem HOT 2
- fortios_system_global timezone not working with FortiOS 7.4.2 and higher HOT 3
- fortinet.fortios.fortios_firewall_addrgrp module question HOT 8
- fortigate firewall firmware upgrade using fortios_monitor module HOT 2
- check mode error since 2.3.5 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-galaxy-fortios-collection.