ansible invoke variable forming from first variable file and string and listed in second variables file

15 views
Skip to first unread message

Rizzy Savage

unread,
Sep 6, 2015, 10:42:07 AM9/6/15
to Ansible Project
We have two variable files, the first files carries constant and the second variables from the output generated.

firstfile.yml

    ---
    prefix: test

secondfile.yml

    ---
    test_variable: 12345

In we are want to call test_variable, but the formation of the variable should be concatenation from firstfile.yml and not `"{{ test_variable }}"`

Example:

    - hosts: localhost
      connection: local
      
      vars: 
      
        constants: firstfile.yml
        variables: seconfile.yml
      
      vars_files:
         
        - [ "{{ constants }}, {{ variables }}"
    
      tasks:
        name: test_name
        field: "{{ prefix }}_variable"

Error: `'test_variable' does not exist</Message></Error></Errors>`
Reply all
Reply to author
Forward
0 new messages