Closed oelu closed 8 months ago
Just to add - this is not environment specific. I've recreated the problem across several ansible/AAP/AWX environments.
Looking at the python source, the variable storing the output path parameter is just not used anywhere after being validated.
Hi @oelu @jgun-at-redhat ,
Thank you for raising this issue, I can reproduce this problem and have reported it to the development team. Here is a workaround solution for temporary reference. I will let you know if that is fixed.
- name: Export playbooks.
hosts: fortigates
connection: httpapi
collections:
- fortinet.fortios
vars:
module_name: firewall_policy
vdom: root
ansible_httpapi_use_ssl: 'yes'
ansible_httpapi_validate_certs: 'no'
ansible_httpapi_port: 443
tasks:
- name: Export multiple palybooks
fortinet.fortios.fortios_export_config_playbook:
vdom: "root"
access_token: "3jGnNqbsdfww47btqw1H5rr7d78dcN"
selectors:
- selector: "{{ module_name }}"
output_path : ""
- name: move file
shell: mv {{'./' + module_name + '_playbook.yml'}} {{'./config/' + module_name +'_playbook.yml'}}
Thanks, Maxx
Thanks @MaxxLiu22
Quick note for anyone who's running ansible within a container (ie ansible-navigator or other EE) - you will want to use the copy module to get the generated files out to another system.
As well, if running this task across multiple fortigates, the generated file will be overwritten, one time for each host in the batch. workaround for that is to run this in a separate play that has "serial: 1" set.
Hi @oelu
We've fixed the issue in the collection. Please try it again; it's now possible to assign any valid directory path. If you encounter any further difficulties or have additional questions, feel free to let us know.
Hi all,
the parameter
output_path
infortios_export_config_playbook
has no effect, or is not respected. The output is always saved in the current folder. Looks like a bug to me.We tested with the following playbook:
Best regards Olivier