<commit_before>---
- include_vars: group_vars/{{ ansible_architecture }}.yml

- stat: path=/var/lib/ansible/upgradeIdc0.8.4
  register: st

- name: Remove uwsgi installed using pip (bug #17)
  pip: name=uwsgi state=absent
  when: st.stat.exists == False

- name: Create a simlink to the HDD for the KoomBook
  file: src=/media/hdd/ideascube dest=/var/ideascube state=link
  when: ideascube_version.stdout == "" and use_hdd|bool

- name: Install uwsgi
  apt: name={{ item }} state=present
  with_items:
  - uwsgi
  - uwsgi-plugin-python3
  when: st.stat.exists == False

- name: Configure the ideascube package repository
  template: src=ideascube.list.j2 dest=/etc/apt/sources.list.d/ideascube.list owner=root group=root mode=644
  when: st.stat.exists == False

      #
      # UGLY HACK
      # The ideascube package is not signed (yet)
      # so we install dependencies first, then allow unauthenticated packages,
      # install ideascube, revert the security hole.

- name: Install ideascube dependencies
  apt: name=python3-minimal state=present
  when: st.stat.exists == False

- name: Allow unauthenticated packages
  lineinfile: dest=/etc/apt/apt.conf.d/9999IDEASCUBEISABADBADBOY line='APT::Get::AllowUnauthenticated "true";' create=yes
  when: st.stat.exists == False

- name: Install the ideascube package
  apt: name=ideascube state=latest update_cache=yes
  when: st.stat.exists == False

- name: Remove the unauthenticated hack
  file: path=/etc/apt/apt.conf.d/9999IDEASCUBEISABADBADBOY state=absent
  when: st.stat.exists == False

- name: Copy startup script
  copy: src=hostapd dest=/etc/systemd/system/hostapd.service owner=root group=root mode=664
  when: st.stat.exists == False

- name: remove old sysvinit startup file 
  file: path=/etc/init.d/hostapd state=absent
  when: st.stat.exists == False

- name: Enable service hostapd
  service: name=hostapd enabled=yes
  when: st.stat.exists == False

- name: Restart hostapd
  service: name=hostapd state=restarted
  when: st.stat.exists == False

- name: Create a new interfaces file
  template: src=interfaces.j2 dest=/etc/network/interfaces backup=yes
  when: st.stat.exists == False

- name: Setup startup file for uwsgi
  copy: src=uwsgi.service dest=/etc/systemd/system/uwsgi.service owner=root group=root mode=644
  when: st.stat.exists == False

- name: Enable service uwsgi
  service: name=uwsgi enabled=yes
  when: st.stat.exists == False

- name: Update dnsmasq.conf file
  template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf backup=yes
  when: st.stat.exists == False

- name: Update hosts file
  template: src=hosts.j2 dest=/etc/hosts owner=root group=root mode=755 backup=yes
  when: st.stat.exists == False

- name: Populate {{version}} if empty
  shell: dpkg-query -W  ideascube  | awk '{print $2}' ; echo
  register: ideascube_newversion

- set_fact: version="{{ ideascube_newversion.stdout }}"

- debug: msg="ideascube {{ version }} is now the current version."

- tasks:
  include: ../../../post_tasks.yml task=ideascube version={{ version }}
  when: st.stat.exists == False

# - name: Upgrade IDC done, let's shutdown now.
#   command: shutdown -h now
#   when: st.stat.exists == False<commit_msg>Install network-manager and use NM dispatcher to lunch ansible-pull<commit_after>---
- include_vars: group_vars/{{ ansible_architecture }}.yml

- stat: path=/var/lib/ansible/upgradeIdc0.8.5
  register: st

- name: Remove uwsgi installed using pip (bug #17)
  pip: name=uwsgi state=absent
  when: st.stat.exists == False

- name: Create a simlink to the HDD for the KoomBook
  file: src=/media/hdd/ideascube dest=/var/ideascube state=link
  when: ideascube_version.stdout == "" and use_hdd|bool

- name: Install uwsgi
  apt: name={{ item }} state=present
  with_items:
  - uwsgi
  - uwsgi-plugin-python3
  when: st.stat.exists == False

- name: Configure the ideascube package repository
  template: src=ideascube.list.j2 dest=/etc/apt/sources.list.d/ideascube.list owner=root group=root mode=644
  when: st.stat.exists == False

      #
      # UGLY HACK
      # The ideascube package is not signed (yet)
      # so we install dependencies first, then allow unauthenticated packages,
      # install ideascube, revert the security hole.

- name: Install ideascube dependencies
  apt: name=python3-minimal state=present
  when: st.stat.exists == False

- name: Allow unauthenticated packages
  lineinfile: dest=/etc/apt/apt.conf.d/9999IDEASCUBEISABADBADBOY line='APT::Get::AllowUnauthenticated "true";' create=yes
  when: st.stat.exists == False

- name: Install the ideascube package
  apt: name=ideascube state=latest update_cache=yes
  when: st.stat.exists == False

- name: Remove the unauthenticated hack
  file: path=/etc/apt/apt.conf.d/9999IDEASCUBEISABADBADBOY state=absent
  when: st.stat.exists == False

- name: Copy startup script
  copy: src=hostapd dest=/etc/systemd/system/hostapd.service owner=root group=root mode=664
  when: st.stat.exists == False

- name: remove old sysvinit startup file 
  file: path=/etc/init.d/hostapd state=absent
  when: st.stat.exists == False

- name: Enable service hostapd
  service: name=hostapd enabled=yes
  when: st.stat.exists == False

- name: Restart hostapd
  service: name=hostapd state=restarted
  when: st.stat.exists == False

- name: Create a new interfaces file
  template: src=interfaces.j2 dest=/etc/network/interfaces backup=yes
  when: st.stat.exists == False

- name: Setup startup file for uwsgi
  copy: src=uwsgi.service dest=/etc/systemd/system/uwsgi.service owner=root group=root mode=644
  when: st.stat.exists == False

- name: Enable service uwsgi
  service: name=uwsgi enabled=yes
  when: st.stat.exists == False

- name: Update dnsmasq.conf file
  template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf backup=yes
  when: st.stat.exists == False

- name: Update hosts file
  template: src=hosts.j2 dest=/etc/hosts owner=root group=root mode=755 backup=yes
  when: st.stat.exists == False

- name: Install Network-Manager
  apt: name=network-manager state=latest
  when: st.stat.exists == False

- name: Create entry to clone/pull git repository
  template: src=nm-dispatcher.j2 dest=/etc/NetworkManager/dispatcher.d/ansiblePullUpdate
    owner=root group=root mode=0755
  when: st.stat.exists == False

- name: remove old way of lunching ansible-pull
  file: path=/etc/dhcp/dhclient-exit-hooks.d/ansiblePullUpdate state=absent
  when: st.stat.exists == False

- name: Populate {{version}} if empty
  shell: dpkg-query -W  ideascube  | awk '{print $2}' ; echo
  register: ideascube_newversion

- set_fact: version="{{ ideascube_newversion.stdout }}"

- debug: msg="ideascube {{ version }} is now the current version."

- tasks:
  include: ../../../post_tasks.yml task=ideascube version={{ version }}
  when: st.stat.exists == False

# - name: Upgrade IDC done, let's shutdown now.
#   command: shutdown -h now
#   when: st.stat.exists == False
{'fraction_non_alphanumeric': 0.11690569317687961, 'fraction_numerical': 0.009995654063450673, 'mean_word_length': 3.9491039426523296, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '222449', 'n_tokens_mistral': 2413, 'n_tokens_neox': 2320, 'n_words': 633}