also check out ansible vault

On Mon, Aug 20, 2018 at 4:16 AM Kai Stian Olstad <
ansible-project+l...@olstad.com> wrote:

> On Monday, 20 August 2018 05.58.58 CEST nbctcp wrote:
> > 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
> >
> > # cat ../hosts
> > [cisco]
> > cisco1 ansible_host=10.0.10.121
> >
> > [forti]
> > fgt1 ansible_host=10.0.10.123
>
> In group_vars/forti.yml you can have any variable you like, so lets say
> forti_password.
>
> group_vars/forti.yml
> ---
> forti_password: admin
>
>
> > # cat playbooks/forti.yml
> > ---
> > - name: fortios command
> >   connection: local
> >   hosts: forti
> >   tasks:
> >     - name: backup
> >       fortios_config:
> >         host: fgt1
> >         username: admin
> >         password: admin
> >         backup: yes
> >         backup_path: "backup/forti"
> >         backup_filename:
> > "{{inventory_hostname}}_{{ansible_date_time.date}}.cfg"
>
> Instead of
>   password: admin
> you use
>   password: '{{ forti_password }}'
>
>
> You also have host_vars that you can use, host_vars will overwrite the
> same variable in group_vars that way you can easily have unique password on
> all or some of your hosts and use the same playbook.
>
> --
> Kai Stian Olstad
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/3056363.FfUnUlk6MR%40x1.
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Jonathan lozada de la matta

AUTOMATION CONSULTANT - AUTOMATION PRACTICE

Red Hat Consulting Services <https://www.redhat.com/>

jloza...@redhat.com

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BLxV6jGnNmNQL-ZE4KS3R4_SZe1WypYMSqXMJobCndA1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to