From 83f698e18c3401212ba88527319c4de63ad13ec1 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Mon, 30 Jan 2023 00:39:33 +0100 Subject: Manage Salt roleproxy Add role, profile and pillar for roleproxy. Signed-off-by: Georg Pfuetzenreuter --- pillar/role/salt/roleproxy.sls | 12 ++++++++++++ salt/profile/salt/roleproxy.sls | 34 ++++++++++++++++++++++++++++++++++ salt/role/salt/roleproxy.sls | 2 ++ 3 files changed, 48 insertions(+) create mode 100644 pillar/role/salt/roleproxy.sls create mode 100644 salt/profile/salt/roleproxy.sls create mode 100644 salt/role/salt/roleproxy.sls diff --git a/pillar/role/salt/roleproxy.sls b/pillar/role/salt/roleproxy.sls new file mode 100644 index 0000000..13f74bd --- /dev/null +++ b/pillar/role/salt/roleproxy.sls @@ -0,0 +1,12 @@ +salt: + roleproxy: + nb_host: ${'secret_salt:roleproxy:nb_host'} + nb_token: ${'secret_salt:roleproxy:nb_token'} + +firewalld: + zones: + internal: + ports: + - comment: salt-roleproxy + port: 4580 + protocol: tcp diff --git a/salt/profile/salt/roleproxy.sls b/salt/profile/salt/roleproxy.sls new file mode 100644 index 0000000..a7393f7 --- /dev/null +++ b/salt/profile/salt/roleproxy.sls @@ -0,0 +1,34 @@ +{%- set roleproxy_pillar = pillar['salt']['roleproxy'] -%} + +salt_roleproxy_packages: + pkg.installed: + - names: + - salt-netbox-roleproxy + - watch_in: + - service: salt_roleproxy_service + +salt_roleproxy_sysconfig: + file.keyvalue: + - name: /etc/sysconfig/roleproxy + - separator: '=' + - show_changes: False + - key_values: + NB_HOST: {{ roleproxy_pillar['nb_host'] }} + NB_TOKEN: {{ roleproxy_pillar['nb_token'] }} + - require: + - pkg: salt_roleproxy_packages + - watch_in: + - service: salt_roleproxy_service + +salt_roleproxy_service_enable: + service.enabled: + - name: roleproxy + - require: + - pkg: salt_roleproxy_packages + +salt_roleproxy_service: + service.running: + - name: roleproxy + - watch: + - pkg: salt_roleproxy_packages + - file: salt_roleproxy_sysconfig diff --git a/salt/role/salt/roleproxy.sls b/salt/role/salt/roleproxy.sls new file mode 100644 index 0000000..7b5ac78 --- /dev/null +++ b/salt/role/salt/roleproxy.sls @@ -0,0 +1,2 @@ +include: + - profile.salt.roleproxy -- cgit v1.2.3