1

Using ansible-container (version 0.2.0) and trying to pass variables to the playbook (main.yml) using the var_files directive. No luck. Keep getting:

ansible-container_1 | ERROR! 'var_files' is not a valid attribute for a Play

The main.yml file has this block:

- hosts: all
  var_files:
      - postgres_vars.yml

Docs seem to suggest this is the right approach.

https://docs.ansible.com/ansible-container/container_yml/template.html#passing-variables-to-your-playbook

All suggestions appreciated.

Follow-up: Tried the suggestions listed in the docs and they don't seem to work either.

sudo ansible-container --var-file ./ansible/postgres_vars.yml build --from-scratch

fails with missing variable name error.

techraf
  • 64,883
  • 27
  • 193
  • 198
mistertee
  • 655
  • 1
  • 5
  • 14

1 Answers1

3

It should be vars_files (plural vars) in the playbook: docs.

There's a typo in ansible-container example.

Konstantin Suvorov
  • 65,183
  • 9
  • 162
  • 193