Oefenweb / ansible-r

Ansible role to set up (the latest version of) R in Ubuntu systems
MIT License
42 stars 27 forks source link

Installing additional packages fails #6

Closed verdurin closed 8 years ago

verdurin commented 8 years ago

Hello

Thanks for making this available - it's very useful.

However, I'm having trouble installing additional packages, with the following simple playbook:


---
- hosts: all
  sudo: true
  remote_user: centos
  vars:
    r_install_dev: True
    r_install: ['r-recommended']
    r_packages: ['dplyr']
  roles:
    - ansible-r

This is the error I see:

TASK: [ansible-r | packages | install] ****************************************
fatal: [frontend001] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute002] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute001] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute003] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute005] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute006] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute004] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute007] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute008] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute011] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute010] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute012] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute013] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute014] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute015] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute016] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute009] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute017] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute018] => One or more undefined variables: 'unicode object' has no attribute 'name'
fatal: [compute019] => One or more undefined variables: 'unicode object' has no attribute 'name'

FATAL: all hosts have already failed -- aborting

I tried adding the packages into the 'r_install' variable, but they didn't work there either:


---
- hosts: all
  sudo: true
  remote_user: centos
  vars:
    r_install_dev: True
    r_install: ['r-recommended', 'dplyr']
  roles:
    - ansible-r

producing the error:

failed: [compute019] => (item=r-recommended,dplyr) => {"failed": true, "item": "r-recommended,dplyr"}
msg: No package matching 'dplyr' is available
tersmitten commented 8 years ago

r_packages is a list of dictionaries, see this file:

The playbook below will probably fix your problems (not tested):

- hosts: localhost
  remote_user: root
  roles:
    - ansible-r
  vars:
    r_install_dev: true
    # apt packages
    r_install:
      - r-recommended
    # cran-r packages
    r_packages:
      - name: dplyr
verdurin commented 8 years ago

Yes, something like that works. The README should probably be expanded to include this clarification, which wasn't apparent to me, at least. In other words, it wasn't clear that r_install is for DEBs and r_packages is for R packages.

Thanks.