pichuang / infra-ansible

Tooling / Ansible to support the many aspects of infrastructure installation, setup and configuration.
Apache License 2.0
0 stars 0 forks source link

ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_eth0 #5

Closed pichuang closed 5 years ago

pichuang commented 5 years ago

TASK [config-clair : Set Clair Address] ** fatal: [quay-v2.pichuang.local]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_eth0'\n\nThe error appears to have been in '/home/pichuang/code/infra-ansible/roles/config-clair/tasks/main.yml': line 8, 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: Set Clair Address\n ^ here\n"}

pichuang commented 5 years ago
01:13:49 pichuang@bastion 0 ~/code/infra-ansible/roles/config-clair (quay*)
$ grep -R "ansible_eth0" ./*
./defaults/main.yml:postgresql_db_uri: "postgresql://{{ postgresql_username }}:{{ postgresql_password }}@{{ postgresql_host if postgresql_host is defined and postgresql_host|trim != '' else hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] }}:{{ postgresql_port | default('5432') }}/{{ postgresql_database | default('clair') }}{{ '?sslmode=disable' if not postgresql_ssl_enabled }}"
./tasks/main.yml:    clair_address: "http://{{ hostvars[inventory_hostname]['ansible_eth0']['ipv4']['address'] }}"
pichuang commented 5 years ago

Solution ansible_eth0 -> ansible_ens192