---
- name: Update package cache (Debian/Ubuntu)
  apt:
    update_cache: yes
  when: ansible_os_family == "Debian"

- name: Install Chromium browser
  package:
    name: "{{ chromium_package }}"
    state: present

- name: Install KeePassXC
  package:
    name: keepassxc
    state: present

- name: Ensure Chromium policies directory exists
  file:
    path: /etc/chromium/policies/managed
    state: directory
    mode: '0755'

- name: Copy the extensions policy file for Chromium
  template:
    src: extensions_policy.json.j2
    dest: /etc/chromium/policies/managed/extensions_policy.json
    mode: '0644'
