---
# vim: set ft=ansible:


- name: copy sources.list
  become: true
  template:
    src: sources.list.j2
    dest: /etc/apt/sources.list
    owner: root
    group: root
    mode: 0644

- name: remove apt packages
  become: true
  apt:
    name: "{{ item }}"
    purge: yes
    autoremove: yes
    state: absent
  with_items: "{{ apt_packages_to_remove }}"
  notify: apt changed

- name: upgrade apt packages
  become: true
  apt:
    update_cache: yes
    upgrade: full
  notify: apt changed

- name: install mandatory packages
  become: true
  apt:
    name: "{{ item }}"
    state: present
  with_items: "{{ apt_mandatory_packages }}"
  notify: apt changed

- name: find out tmux version
  shell: tmux -V | cut -f2- -d' '
  register: tmux_version
  changed_when: false

- name: install tmux >= 2.1
  become: true
  apt:
    deb: "{{ tmux_deb_link }}"
    state: present
  when: tmux_version.stdout | version_compare('2.2', '<')
  notify: apt changed

---
# vim: set ft=ansible:


- name: copy sources.list
  become: true
  template:
    src: sources.list.j2
    dest: /etc/apt/sources.list
    owner: root
    group: root
    mode: 0644

- name: remove apt packages
  become: true
  apt:
    name: "{{ item }}"
    purge: yes
    autoremove: yes
    state: absent
  with_items: "{{ apt_packages_to_remove }}"
  notify: apt changed

- name: install HWE stack
  become: true
  apt:
    name: "linux-generic-hwe-{{ ansible_distribution_version }}"
    state: present
  notify: apt changed

- name: upgrade apt packages
  become: true
  apt:
    update_cache: yes
    upgrade: full
  notify: apt changed

- name: install mandatory packages
  become: true
  apt:
    name: "{{ item }}"
    state: present
  with_items: "{{ apt_mandatory_packages }}"
  notify: apt changed

- name: find out tmux version
  shell: tmux -V | cut -f2- -d' '
  register: tmux_version
  changed_when: false

- name: install tmux >= 2.1
  become: true
  apt:
    deb: "{{ tmux_deb_link }}"
    state: present
  when: tmux_version.stdout | version_compare('2.2', '<')
  notify: apt changed

Install HWE for LTS boxes
Install HWE for LTS boxes
