Ansible: Install Firefox extension
Problem
Using Ansible, how can I install a Firefox extension on a host.
Environment
- firefox-26.0
Solution
Unzip the extension. Note the extension-id (<em:id>) in install.rdf
Copy the unzipped extension files to the host machine in /home/<user>/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/<extension-id>
Now when firefox is restarted on the host machine, the user will be asked to confirm the installation.
Here's an example playbook for installing Adblock Edge (change "me" to username):
##
# Ansible playbook to install firefox
#
---
- hosts: workstations
user: me
sudo: yes
tasks:
- name: Ensure package firefox is installed
apt: pkg=firefox state=present
- name: Ensure extension AdblockEdge is installed
local_action: >
command rsync -Cavz
firefox/extensions/AdblockEdge/{fe272bd1-5f76-4ea4-8501-a05d35d823fc}
me@{{ inventory_hostname }}:/home/me/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/See also: How to install Firefox addon from command line in scripts? - Ask Ubuntu
Journal
20171106
- Ansible Galaxy | alzadude.firefox-addon
- An Ansible role which provides a firefox_addon module for installing or uninstalling Firefox addons
20121226
How to install Firefox addon from command line in scripts? - Ask Ubuntu: http://askubuntu.com/questions/73474/how-to-install-firefox-addon-from-command-line-in-scripts
Solution: Install in ~/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}
Pro: When user starts firefox, user is asked permission to install extension
Con: Extension can't be uninstalled, only disabled. Uninstall is possible by removing extension from above directory. Or does Ansible install it again?