---

- name: Install common utils
  apt:
    name: "{{item}}"
    state: present
  with_items:
    - bash-completion
    - git
    - htop
    - python-software-properties
    - vim
  become: true
  tags:
    - common

- name: Install Pip
  apt:
    name: python-pip
    state: present
  become: true
  tags:
    - common

- name: Install Python packages for validating SSL certificates with SNI
  pip:
    name: supervisor
  with_items:
    - ndg-httpsclient
    - pyasn1
    - pyOpenSSL
    - urllib3
  become: true
  tags:
    - common

---

- name: Install common utils
  apt:
    name: "{{item}}"
    state: present
  with_items:
    - bash-completion
    - git
    - htop
    - python-software-properties
    - vim
  become: true
  tags:
    - common

- name: Install Pip
  apt:
    name: python-pip
    state: present
  become: true
  tags:
    - common

- name: Install Python packages for validating SSL certificates with SNI
  pip:
    name: supervisor
  with_items:
    - ndg-httpsclient
    - pyasn1
    - pyOpenSSL
    - urllib3
  become: true
  tags:
    - common

- name: Set Vim as default system-wide editor
  command: update-alternatives --set editor /usr/bin/vim.basic
  args:
    creates: /etc/alternatives/editor
  become: true
  tags:
    - common

- name: Set Vim as default user editor
  lineinfile:
    dest: "{{ ansible_env.HOME }}/.selected_editor"
    regexp: "^SELECTED_EDITOR=.+?$"
    line: 'SELECTED_EDITOR="/usr/bin/vim.basic"'
    create: true
    state: present
  become: false
  tags:
    - common

Set default editor in Ubuntu
Set default editor in Ubuntu
