---

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

- name: Install Pip
  apt:
    name: python-pip
    state: present
    install_recommends: false
  become: true
  become_user: root
  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
  become_user: root
  tags:
    - common

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

---

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

- name: Install Pip
  apt:
    name: python-pip
    state: present
    install_recommends: false
  become: true
  become_user: root
  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
  become_user: root
  tags:
    - common

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

Install "acl" package for Ansible to be able to sudo
Install "acl" package for Ansible to be able to sudo

https://docs.ansible.com/ansible/latest/become.html#becoming-an-unprivileged-user
