fortios need host, username, password in every "- name"

Hi,

I have playbook for fortios and working.
But is that possible

  1. I don’t want to put password in playbook, but put that in group_vars/forti.yml
  2. In cisco I can apply playbook to group name in hosts
    i.e.

cat playbooks/cisco.yml

In group_vars/forti.yml you can have any variable you like, so lets say forti_password.

group_vars/forti.yml

also check out ansible vault

QUESTION1: SOLVED
QUESTION2: Here my goal
I have 2 fortigate (fgt1 and fgt2 with their respective ip)
I want to backup both using 1 group name “forti” instead issuing 1 backup task to each fgt1 and fgt2
Is that possible?
tq

cat hosts

[forti]

fgt1 ansible_host=10.0.10.123
fgt2 ansible_host=10.0.10.124

cat group_vars/forti.yml

have you run it this way yet? it should do both host in that group

with this setting, I got this erro

cat playbooks/forti.yml

are you able to connect to it regularly? at the end you can see this error

},
“msg”: “Error connecting device”

PROBLEMS:
-with working playbook.
backup applied on both fgt1 and fgt2 but
address (LAN) and policy task (LAN2WAN DNS) only applied on fgt1

WORKING

cat forti.yml

Your host n the module need to different for each host so use the variable ansible_host or inventory_hostanme.

SOLVED
tq

Hello,

how did you managed to make it work?