graphite-grafana-vagrant-box icon indicating copy to clipboard operation
graphite-grafana-vagrant-box copied to clipboard

Ansible problem

Open verdurin opened this issue 9 years ago • 1 comments

Hello

I've just tried this, with a local Ansible version of 2.0.0.2 and I see this error at startup:

TASK [nginx : Install the nginx packages] **************************************
[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.
fatal: [default]: FAILED! => {"failed": true, "msg": "ERROR! environment must be a dictionary, received nginx_env (<class 'ansible.parsing.yaml.objects.AnsibleUnicode'>)"}

PLAY RECAP *********************************************************************
default                    : ok=3    changed=0    unreachable=0    failed=1

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

verdurin avatar Jan 28 '16 06:01 verdurin

I had the same issue and I fixed it with the following patch:

diff --git a/roles/nginx/tasks/installation.packages.yml b/roles/nginx/tasks/installation.packages.yml
index 5937402..481d155 100644
--- a/roles/nginx/tasks/installation.packages.yml
+++ b/roles/nginx/tasks/installation.packages.yml
@@ -24,14 +24,14 @@
 - name: Install the nginx packages
   apt: name={{ item }} state=present
   with_items: nginx_ubuntu_pkg
-  environment: nginx_env
+  environment: '{{nginx_env}}'
   when: ansible_os_family == "Debian"
   tags: [packages,nginx]

 - name: Install the nginx packages
   pkgng: name={{ item }} state=present
   with_items: nginx_freebsd_pkg
-  environment: nginx_env
+  environment: '{{nginx_env}}'
   when: ansible_os_family == "FreeBSD"
   tags: [packages,nginx]

alessio-santacroce avatar Mar 21 '16 11:03 alessio-santacroce