added firefox state and pillar

This commit is contained in:
Jonas Forsberg 2020-08-02 17:25:30 +02:00
parent 4ab12077ac
commit b00a4f7a6f
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9
4 changed files with 27 additions and 4 deletions

8
salt/pillars/firefox.sls Normal file
View File

@ -0,0 +1,8 @@
firefox:
addons:
FoxyProxy Standard:
url: https://addons.mozilla.org/firefox/downloads/latest/foxyproxy-standard/
name: foxyproxy@eric.h.jung.xpi
KeePassXC-Browser:
url: https://addons.mozilla.org/firefox/downloads/latest/keepassxc-browser/
name: keepassxc-browser@keepassxc.org.xpi

View File

@ -15,3 +15,9 @@ repositories:
enabled: True enabled: True
gpgautoimport: True gpgautoimport: True
refresh: True refresh: True
firefox:
addons:
Okta Browser Plugin:
url: https://addons.mozilla.org/firefox/downloads/latest/okta-browser-plugin/
name: plugin@okta.com.xpi

View File

@ -3,8 +3,10 @@ base:
- packages - packages
- repositories - repositories
- vim - vim
- firefox
- hosts
{% if salt['file.file_exists']('hosts/{0}.sls'.format(grains.id)) %} #{% if salt['file.file_exists']('hosts/{0}.sls'.format(grains.nodename)) %}
'{{ grains.id }}': # '{{ grains.nodename }}':
- hosts.{{ grains.id }} # - hosts.{{ grains.nodename }}
{% endif %} #{% endif %}

7
salt/states/firefox.sls Normal file
View File

@ -0,0 +1,7 @@
{% for name, args in pillar['firefox']['addons'].items() %}
Downloading {{ name }} Firefox xpi:
cmd.run:
- name: curl -sLo {{ salt['user.info']( pillar['username'] ).home }}/.mozilla/firefox/$(sed -n 's/^Path=\(.*\)$/\1/p' {{ salt['user.info']( pillar['username'] ).home }}/.mozilla/firefox/profiles.ini)/{{ args['name'] }} {{ args['url'] }}
- unless: grep -oP '(?<=\},\"name\":\"){{ name }}' {{ salt['user.info']( pillar['username'] ).home }}/.mozilla/firefox/*.default*/addons.json
- user: {{ pillar['username'] }}
{% endfor %}