#!/bin/bash set -aeo pipefail {% for name, url in pillar['firefox']['addons'].items() %} if [[ $(grep -oP '(?<=\},\"name\":\"){{ name }}' {{ salt['user.info']( pillar['username'] ).home }}/.mozilla/firefox/*.default*/addons.json) ]]; then printf "{{ name }} is already installed\n" else printf "installing {{ name }}\n" firefox {{ url }} fi {% endfor %}