<commit_before>---
- name: Ensure group "radmin" exists
  group:
    name: radmin
    state: present
    
- name: adding existing user "{{ deploy_user_name }}" to group radmin
  user:
    name: "{{ deploy_user_name }}"
    groups: radmin
    append: yes

- name: Add R repository public key
  apt_key:
    id: <KEY>
    keyserver: keyserver.ubuntu.com
    state: present

- name: Add R repository
  apt_repository:
    repo: "{{ item.type }} {{ item.url }}"
    state: present
    update_cache: true
  with_items: "{{ r_repository }}"

- name: Install Packages
  apt: name="{{ packages }}" state=latest
  vars:
    packages:
      - r-base
      - r-recommended
      - r-base-dev
      - r-cran-rjava
      - libxml2-dev
      - libgdal1-dev
      - libproj-dev
      - libssl-dev
      - software-properties-common

- name: Creates .Rprofile with default repo
  lineinfile: dest=/home/{{deploy_user_name}}/.Rprofile line='local({r <- getOption("repos");r["CRAN"] <- "https://mran.revolutionanalytics.com/snapshot/2018-10-03";options(repos = r)})' create=True
  vars:
    ansible_ssh_pipelining: true
  become: yes
  become_user: "{{deploy_user_name}}"

#- name: Creates .Rprofile with default repo
#  lineinfile: dest=/home/{{deploy_user_name}}/.Renviron line='R_LIBS_SITE=/home/{{deploy_user_name}}/R/rpackages' create=True

- name: Creates user R package directory
  file: path=/home/{{deploy_user_name}}/R/rpackages state=directory  owner={{deploy_user_name}} group={{deploy_user_name}}

- name: Creates .Rprofile with default repo
  lineinfile: dest=/root/.Rprofile line='local({r <- getOption("repos");r["CRAN"] <- "https://mran.revolutionanalytics.com/snapshot/2018-10-03";options(repos = r)})' create=True
  
- name: Ensure /usr/local/lib/R/site-library/ is writable by radmin
  file: dest=/usr/local/lib/R/site-library/ owner=root group=radmin mode=u=rwX,g=rwX,o=rX recurse=yes

# : ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/amd64/server}
- name: Config java
  command: R CMD javareconf

- name: print to stdout
  command: "Rscript -e '.libPaths()'"
  register: rout

- debug: msg="{{ rout.stdout }}"
<commit_msg>Do no install r-java<commit_after>---
- name: Ensure group "radmin" exists
  group:
    name: radmin
    state: present
    
- name: adding existing user "{{ deploy_user_name }}" to group radmin
  user:
    name: "{{ deploy_user_name }}"
    groups: radmin
    append: yes

- name: Add R repository public key
  apt_key:
    id: <KEY>
    keyserver: keyserver.ubuntu.com
    state: present

- name: Add R repository
  apt_repository:
    repo: "{{ item.type }} {{ item.url }}"
    state: present
    update_cache: true
  with_items: "{{ r_repository }}"

- name: Install Packages
  apt: name="{{ packages }}" state=latest
  vars:
    packages:
      - r-base
      - r-recommended
      - r-base-dev
      - libxml2-dev
      - libgdal1-dev
      - libproj-dev
      - libssl-dev
      - software-properties-common

- name: Creates .Rprofile with default repo
  lineinfile: dest=/home/{{deploy_user_name}}/.Rprofile line='local({r <- getOption("repos");r["CRAN"] <- "https://mran.revolutionanalytics.com/snapshot/2018-10-03";options(repos = r)})' create=True
  vars:
    ansible_ssh_pipelining: true
  become: yes
  become_user: "{{deploy_user_name}}"

#- name: Creates .Rprofile with default repo
#  lineinfile: dest=/home/{{deploy_user_name}}/.Renviron line='R_LIBS_SITE=/home/{{deploy_user_name}}/R/rpackages' create=True

- name: Creates user R package directory
  file: path=/home/{{deploy_user_name}}/R/rpackages state=directory  owner={{deploy_user_name}} group={{deploy_user_name}}

- name: Creates .Rprofile with default repo
  lineinfile: dest=/root/.Rprofile line='local({r <- getOption("repos");r["CRAN"] <- "https://mran.revolutionanalytics.com/snapshot/2018-10-03";options(repos = r)})' create=True
  
- name: Ensure /usr/local/lib/R/site-library/ is writable by radmin
  file: dest=/usr/local/lib/R/site-library/ owner=root group=radmin mode=u=rwX,g=rwX,o=rX recurse=yes

# : ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/amd64/server}
#- name: Config java
#  command: R CMD javareconf

- name: print to stdout
  command: "Rscript -e '.libPaths()'"
  register: rout

- debug: msg="{{ rout.stdout }}"

{'fraction_non_alphanumeric': 0.1504007543611504, 'fraction_numerical': 0.00942951438000943, 'mean_word_length': 3.58207343412527, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5261218', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1481, 'n_words': 320}