geerlingguy/ansible-role-ruby

Define ruby_install_gems_user fails because ansible_ssh_user is undefined

AP-Hunt opened this issue · 1 comments

Issue
The task Define ruby_install_gems_user fails because ansible_ssh_user is undefined.

TASK [geerlingguy.ruby : Define ruby_install_gems_user.] ***********************
fatal: [localhost]: FAILED! => {"failed": true, "msg": "'ansible_ssh_user' is undefined"}

According to the Ansible documentation, the variable was deprecated in Ansible 2.0

Ansible 2.0 has deprecated the “ssh” from ansible_ssh_user, ansible_ssh_host, and ansible_ssh_port to become ansible_user, ansible_host, and ansible_port. If you are using a version of Ansible prior to 2.0, you should continue using the older style variables (ansible_ssh_*). These shorter variables are ignored, without warning, in older versions of Ansible.

Investigation shows that, as of Ansible 2.0, ansible_user is not set when the --user option isn't provided.

Steps to reproduce
Playbook:


---
- hosts: localhost
  become: yes
  roles:
    - geerlingguy.ruby
  1. Create a new a new Vagrant virtual machine with Ansible 2.0.2.0 installed
  2. Install the geerlingguy.ruby role, version 2.3.1
  3. ansible-playbook playbook.yml (note: no options specified)

Version
Ansible installed via package in ppa:ansible/ansible, role installed via ansible-galaxy

vagrant@vagrant-ubuntu-trusty-64:~$ ansible-playbook --version
ansible-playbook 2.0.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ansible-galaxy list -p roles/ geerlingguy.ruby
- geerlingguy.ruby, 2.3.1

This was fixed by #28 - thanks for reporting!