<commit_before>---
- name: fail if not a new release of Ubuntu
  fail:
    msg: "{{ ansible_distribution_version }} is not an acceptable version of Ubuntu for this role"
  when: "ansible_distribution_version not in ['14.04', '14.10']"

- name: add Docker repository key
  apt_key:
    url: "https://get.docker.io/gpg"
    state: present

- name: add Docker repository and update apt cache
  apt_repository:
    repo: "deb https://get.docker.io/ubuntu docker main"
    update_cache: yes
    state: present

- name: install docker package
  apt:
    name: lxc-docker
    state: latest
    update_cache: yes

- name: enable port forwarding
  lineinfile: 
    dest: /etc/default/ufw
    regexp: ^DEFAULT_FORWARD_POLICY=
    line: DEFAULT_FORWARD_POLICY="ACCEPT"
  notify: reload ufw

- name: enable memory limitation in cgroupd
  lineinfile: 
    dest: /etc/default/grub
    regexp: ^GRUB_CMDLINE_LINUX=
    line: GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
  register: grub_config

- name: reload grub config
  command: update-grub
  when: grub_config | changed
  notify: reboot vm

- name: waiting 2 minutes for server to come back
  local_action: wait_for timeout=120
  sudo: false
  when: grub_config | changed

- name: test docker installation
  shell: docker run hello-world<commit_msg>allow users from a docker group to run docker command with sudo<commit_after>---
- name: fail if not a new release of Ubuntu
  fail:
    msg: "{{ ansible_distribution_version }} is not an acceptable version of Ubuntu for this role"
  when: "ansible_distribution_version not in ['14.04', '14.10']"

- name: add Docker repository key
  apt_key:
    url: "https://get.docker.io/gpg"
    state: present

- name: add Docker repository and update apt cache
  apt_repository:
    repo: "deb https://get.docker.io/ubuntu docker main"
    update_cache: yes
    state: present

- name: install docker package
  apt:
    name: lxc-docker
    state: latest
    update_cache: yes

- name: enable port forwarding
  lineinfile: 
    dest: /etc/default/ufw
    regexp: ^DEFAULT_FORWARD_POLICY=
    line: DEFAULT_FORWARD_POLICY="ACCEPT"
  notify: reload ufw

- name: enable memory limitation in cgroupd
  lineinfile: 
    dest: /etc/default/grub
    regexp: ^GRUB_CMDLINE_LINUX=
    line: GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
  register: grub_config

- name: reload grub config
  command: update-grub
  when: grub_config | changed
  notify: reboot vm

- name: waiting 2 minutes for server to come back
  local_action: wait_for timeout=120
  sudo: false
  when: grub_config | changed

- name: test docker installation
  shell: docker run hello-world

- name: Make sure docker group can do sudo
  lineinfile: 
    dest: /etc/sudoers 
    state: present 
    regexp: "^%docker.*" 
    line: "%docker ALL=NOPASSWD: /usr/bin/docker"
{'fraction_non_alphanumeric': 0.08731000353481795, 'fraction_numerical': 0.009190526687875575, 'mean_word_length': 3.5207667731629395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1989608', 'n_tokens_mistral': 997, 'n_tokens_neox': 905, 'n_words': 299}