From 283fc7bf32dcd0c46a523d078e635c508b9800f0 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 25 Sep 2021 16:14:22 +0200 Subject: [PATCH] added chrome state --- states/chrome/config.json.j2 | 1 + states/chrome/config.sls | 17 +++++++++++++++++ states/chrome/defaults.yaml | 19 +++++++++++++++++++ states/chrome/init.sls | 4 ++++ states/chrome/map.jinja | 5 +++++ 5 files changed, 46 insertions(+) create mode 100644 states/chrome/config.json.j2 create mode 100644 states/chrome/config.sls create mode 100644 states/chrome/defaults.yaml create mode 100644 states/chrome/init.sls create mode 100644 states/chrome/map.jinja diff --git a/states/chrome/config.json.j2 b/states/chrome/config.json.j2 new file mode 100644 index 0000000..3d72bc5 --- /dev/null +++ b/states/chrome/config.json.j2 @@ -0,0 +1 @@ +{{ config|json }} diff --git a/states/chrome/config.sls b/states/chrome/config.sls new file mode 100644 index 0000000..211d90a --- /dev/null +++ b/states/chrome/config.sls @@ -0,0 +1,17 @@ +--- +{%- from "chrome/map.jinja" import chrome with context %} + +{%- for dir in chrome.directories %} +chrome-directory-{{ dir }}: + file.directory: + - name: {{ dir }} + - makedirs: True +{%- endfor %} + +chrome-policies-managed: + file.managed: + - name: /etc/opt/chrome/policies/managed/managed_policies.json + - source: salt://chrome/config.json.j2 + - context: + config: {{ chrome.config.managed }} + - template: jinja diff --git a/states/chrome/defaults.yaml b/states/chrome/defaults.yaml new file mode 100644 index 0000000..d2bd6e9 --- /dev/null +++ b/states/chrome/defaults.yaml @@ -0,0 +1,19 @@ +--- +chrome: + config: + managed: + AutofillAddressEnabled: false + AutofillCreditCardEnabled: false + BookmarkBarEnabled: false + BrowserSignin: false + HomepageIsNewTabPage: false + HomepageLocation: http://www.google.fr + PasswordManagerEnabled: false + PaymentMethodQueryEnabled: false + RestoreOnStartup: 1 + ShowHomeButton: true + SigninInterceptionEnabled: false + recommended: {} + directories: + - /etc/opt/chrome/policies/managed + - /etc/opt/chrome/policies/recommended diff --git a/states/chrome/init.sls b/states/chrome/init.sls new file mode 100644 index 0000000..e47b77e --- /dev/null +++ b/states/chrome/init.sls @@ -0,0 +1,4 @@ +--- +include: + - .config + diff --git a/states/chrome/map.jinja b/states/chrome/map.jinja new file mode 100644 index 0000000..d70d45b --- /dev/null +++ b/states/chrome/map.jinja @@ -0,0 +1,5 @@ +{%- import_yaml "chrome/defaults.yaml" as default_settings -%} + +{%- set defaults = salt['grains.filter_by'](default_settings, default='chrome') -%} + +{%- set chrome = salt['pillar.get']('chrome', default=defaults, merge=True) -%} \ No newline at end of file