1

I used railbox to create a configuration that I can deploy through vagrant. However, the setup is stopped by the following error.

==> myapp: fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'ansible.vars.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'git'\n\nThe error appears to have been in '/ansible/roles/ruby/tasks/rbenv.yml': line 15, 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 plugins\n ^ here\n"} 

The content of rbenv.yml:

--- - name: Install libffi-dev apt: name=libffi-dev - name: Clone rbenv repository to ~/.rbenv git: repo={{ rbenv_repo }} dest={{ rbenv_path }} version={{ rbenv_version }} accept_hostkey=yes sudo_user: '{{ user_name }}' - name: Create rbenv.sh template: src=rbenv.sh.j2 dest={{ profile_d_path }}/rbenv.sh owner={{ user_name }} group={{ group_name }} - name: Create plugins directory file: path={{ rbenv_plugins_path }} state=directory owner={{ user_name }} group={{ group_name }} - name: Install plugins git: repo={{ item.git }} dest={{ rbenv_plugins_path }}/{{ item.name }} version={{ item.version }} accept_hostkey=yes sudo_user: '{{ user_name }}' with_items: rbenv_plugins - name: Check if ruby installed shell: '{{ rbenv_bin }} versions | grep -q {{ rbenv_ruby_version }}' register: ruby_installed ignore_errors: yes sudo_user: '{{ user_name }}' - name: Install ruby command: '{{ rbenv_bin }} install {{ rbenv_ruby_version }}' sudo_user: '{{ user_name }}' when: ruby_installed|failed - name: Set global ruby version command: '{{ rbenv_bin }} global {{ rbenv_ruby_version }}' sudo_user: '{{ user_name }}' - name: Rehash rbenv command: '{{ rbenv_bin }} rehash' sudo_user: '{{ user_name }}' 

What is wrong with the yml file?

1 Answer 1

1

If you run a recent version of Ansible (I believe it was changed for 2.2) you need to write with jinja2 syntax

- name: Install plugins git: repo={{ item.git }} dest={{ rbenv_plugins_path }}/{{ item.name }} version={{ item.version }} accept_hostkey=yes sudo_user: '{{ user_name }}' with_items: '{{ rbenv_plugins }}' 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.