I am trying ansible 2 and not sure why it got error below
TASK [postgres : include] ******************************************************
task path: /home/stevek/ansible-jumbo/roles/postgres/tasks/main.yml:10
fatal: [test-pg-all]: FAILED! => {“failed”: true, “reason”: “ERROR! duplicate loop in task: items\n\nThe error appears to have been in ‘/home/stevek/ansible-jumbo/roles/postgres/tasks/01-install.yml’: line 7, 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: Install postgres93\n ^ here\n”}
there is no such directive, i'm guessing you want:
environment: "{{proxy_env}}"
2.0 is now better at validating playbooks and unlike previous
versions it does not ignore incorrect entries. The error message
itself seems a bit confusing, but it does point at the correct task.
But v2 refuse to run that code saying expected a dict and got proxy_env. When I switch to env: proxy_env it stopped complaining about it. Probably it is still error at this but give different error message.
I did use it (quote them and put {{}} around) but still got errors
TASK [postgres : Install postgres93] *******************************************
task path: /home/stevek/ansible-jumbo/roles/postgres/tasks/01-install.yml:7
[DEPRECATION WARNING]: Using bare variables for environment is deprecated. Update your playbooks so that the environment
value uses the full variable syntax (‘{{foo}}’). This feature will be removed in a future release. Deprecation warnings
can be disabled by setting deprecation_warnings=False in ansible.cfg.
ESTABLISH CONNECTION FOR USER: root on PORT 22 TO test-pg1-all
EXEC /bin/sh -c ‘mkdir -p “$( echo $HOME/.ansible/tmp/ansible-tmp-1454651909.82-26088368040824 )” && echo “$( echo $HOME/.ansible/tmp/ansible-tmp-1454651909.82-26088368040824 )”’
PUT /tmp/tmp1tF9fp TO /root/.ansible/tmp/ansible-tmp-1454651909.82-26088368040824/yum
fatal: [test-pg1-all]: FAILED! => {“failed”: true, “msg”: “environment must be a dictionary, received proxy_env (<class ‘ansible.parsing.yaml.objects.AnsibleUnicode’>)”}
The proxy_env is a dictionary declared in inventory