On 11/28/20 5:41 PM, amsou wrote: > Ho fols, > > I was wondering if anyone could advise on how I can manage multi environment > variables using ansible. Imagine i have > development and staging. I have the following structure: > > . > ├── inventories > │ ├── development > │ │ ├── group_vars > │ │ │ └── all.yml > │ │ └── hosts > │ └── staging > │ ├─── group_vars > │ │ └── all.yml > │ │ └── hosts > ├── roles > └── test.yml > > > In each all.yml file, i have one variable like this: > > vars: > name:"development"
It should be
name: "development"
as this file is only for variables and therefore "vars: " is not needed.
Regards
Racke
>
>
> I was wondering how is the best approach to load the values depending on a
> parameter to set for example on command line
> (-i env=development).
>
> In test.yml, I have this:
>
> - name: test playbook
> hosts: localhost
> connection: local
>
> tasks:
> - name:
> debug:
> var: name
>
>
> When I execute, I get this:
>
> ansible-playbook -i inventories/development/ test.yml -vvv
> ....
> ok: [localhost] => {
> "name": "VARIABLE IS NOT DEFINED!: 'name' is undefined"
> }
>
> I'm kind of new to ansible and I've found thousands of different ways and I
> was wondering what is the best approach?
> Because I'm kind of lost :( :(
>
> Regards,
>
> --
> 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
> [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f2682791-6bd8-40f4-a7e7-6c83d5c9de72n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f2682791-6bd8-40f4-a7e7-6c83d5c9de72n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/d6731aa7-0ddc-f5b6-1bb3-f72772c26fea%40linuxia.de.
OpenPGP_signature
Description: OpenPGP digital signature
