Ansible: How to install Chrome managed bookmarks
The following Ansible playbook installs Chrome & sets Chrome managed bookmarks host-wide.
---
- name: Install Google Chrome
become: true
hosts: all
tasks:
- name: Add Google Chrome repository key
ansible.builtin.apt_key:
url: https://dl.google.com/linux/linux_signing_key.pub
state: present
- name: Add Google Chrome repository
ansible.builtin.apt_repository:
repo: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
filename: google-chrome
state: present
- name: Install Google Chrome
ansible.builtin.apt:
name: google-chrome-stable
update_cache: yes
state: present
- name: Ensure Chrome managed bookmarks policy directory exists
file:
path: "/etc/opt/chrome/policies/managed"
state: directory
mode: '0755'
- name: Copy managed bookmarks file
copy:
src: "managed_bookmarks.json"
dest: "/etc/opt/chrome/policies/managed/managed_bookmarks.json"
mode: '0644'
With a managed_bookmarks.json
file in the same directory as the playbook such as this one:
{
"ManagedBookmarks": [
{
"name": "Google",
"url": "https://www.google.com"
},
{
"name": "Wikipedia",
"url": "https://www.wikipedia.org"
},
{
"name": "YouTube",
"url": "https://www.youtube.com"
},
{
"name": "GitHub",
"url": "https://github.com"
},
{
"name": "Stack Overflow",
"url": "https://stackoverflow.com"
}
]
}
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow