From b00a4f7a6f7486d63f5c359d4c37fb48d79bfd63 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sun, 2 Aug 2020 17:25:30 +0200 Subject: [PATCH] added firefox state and pillar --- salt/pillars/firefox.sls | 8 ++++++++ salt/pillars/hosts/exsilio.sls | 6 ++++++ salt/pillars/top.sls | 10 ++++++---- salt/states/firefox.sls | 7 +++++++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 salt/pillars/firefox.sls create mode 100644 salt/states/firefox.sls diff --git a/salt/pillars/firefox.sls b/salt/pillars/firefox.sls new file mode 100644 index 0000000..3c5cd0b --- /dev/null +++ b/salt/pillars/firefox.sls @@ -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 diff --git a/salt/pillars/hosts/exsilio.sls b/salt/pillars/hosts/exsilio.sls index 12fef39..a611f9f 100644 --- a/salt/pillars/hosts/exsilio.sls +++ b/salt/pillars/hosts/exsilio.sls @@ -15,3 +15,9 @@ repositories: enabled: True gpgautoimport: True refresh: True + +firefox: + addons: + Okta Browser Plugin: + url: https://addons.mozilla.org/firefox/downloads/latest/okta-browser-plugin/ + name: plugin@okta.com.xpi diff --git a/salt/pillars/top.sls b/salt/pillars/top.sls index f2a8884..8841329 100644 --- a/salt/pillars/top.sls +++ b/salt/pillars/top.sls @@ -3,8 +3,10 @@ base: - packages - repositories - vim + - firefox + - hosts -{% if salt['file.file_exists']('hosts/{0}.sls'.format(grains.id)) %} - '{{ grains.id }}': - - hosts.{{ grains.id }} -{% endif %} +#{% if salt['file.file_exists']('hosts/{0}.sls'.format(grains.nodename)) %} +# '{{ grains.nodename }}': +# - hosts.{{ grains.nodename }} +#{% endif %} diff --git a/salt/states/firefox.sls b/salt/states/firefox.sls new file mode 100644 index 0000000..4f19eab --- /dev/null +++ b/salt/states/firefox.sls @@ -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 %}