I have defined the nginx_upstreams variable in a different role that in turn uses the geerlingguy.nginx role and I have also specified the "name", "strategy" and the "servers", but when I run this role, ansible throws the error given below as if it cannot access the "name" variable defined for nginx_upstream.
This is the task that throws the error
- name: Create upstream files
file:
path: "{{ nginx_vhost_path }}/{{ item.name + '.conf' }}"
state: touch
with_items: "{{ nginx_upstreams }}"
This the role to use where the "nginx_upstreams" are defined.
- name: "Configure specific nginx service for concert to connect on remote host"
include_role:
name: geerlingguy.nginx
vars:
#for configuration specific to each server
nginx_upstreams:
- name: SOME_UPSTREAM_NAME
strategy: SOME_STRATEGY
servers: "{{ SOME_SERVER }}"
This is the ERROR that I get-
fatal: [IP]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'value'\n\nThe error appears to be in '/etc/ansible/roles/geerlingguy.nginx/tasks/vhosts.yml': line 29, 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: Create upstream files\n ^ here\n"}
path: "{{ nginx_vhost_path }}/{{ item.name }}.conf"
– Britteny