Error when creating database
twiedow opened this issue · 1 comments
twiedow commented
Hi,
I get a strange error when I create a database. Ansible complaints that there is an error in the file tasks/databases.yml
of the role. Is there something wrong in my playbook and the error message just misleading?
I am using Vagrant 2.2.16 with ansible [core 2.11.0].
TASK [geerlingguy.postgresql : Ensure PostgreSQL databases are present.] *******
ok: [my-vagrant.vm] => (item={'name': 'my_db'})
fatal: [my-vagrant.vm]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'name'\n\nThe error appears to be in '/Users/<user-dir>/.ansible/roles/geerlingguy.postgresql/tasks/databases.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- name: Ensure PostgreSQL databases are present.\n ^ here\n"}
- name: install postgresql
include_role:
name: geerlingguy.postgresql
vars:
postgresql_databases:
- name: "{{ postgres_db_name }}"
- port: "{{ postgres_port }}"
postgresql_users:
- name: "{{ postgres_username }}"
password: "{{ postgres_password }}"
db: "{{ postgres_db_name }}"
postgresql_hba_entries:
- { type: host, database: all, user: all, address: '0.0.0.0/0', auth_method: md5 }
- { type: host, database: all, user: all, address: '::/0', auth_method: md5 }
postgresql_global_config_options:
- option: listen_addresses
value: '*'
postgresql_packages:
- postgresql-12-postgis-3
- postgresql-12-postgis-3-scripts
Btw, thank your very much for your great work!
twiedow commented
Found it, 'port' had a wrong '-' as prefix.