#####################################
### someone's ansible provisioner ###
#####################################
# Part of: https://git.somenet.org/root/pub/somesible.git
# 2017-2025 by someone <someone@somenet.org>
#
---
- name: add google-chrome.list to apt
  copy:
    src: "{{item}}"
    dest: "/etc/apt/sources.list.d/google-chrome.list"
    mode: 0644
    owner: "root"
    group: "root"
  with_first_found:
    - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/google-chrome.list"
    - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/google-chrome.list"
    - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/google-chrome.list"
    - "default/google-chrome.list"
  register: apt_list_changes


- name: add google-chrome key to keyring
  apt_key:
    url: https://dl.google.com/linux/linux_signing_key.pub
    state: present
  tags: "online"


- name: update the repository cache
  apt:
    update_cache: yes
  tags: "online"
  when: apt_list_changes.changed


- name: install google-chrome
  apt:
    pkg:
    - google-chrome-stable
    state: present
    policy_rc_d: 101
  tags: "online"
