From 262c03d359a282e886082b3ce20c6f6f364c0f13 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Mon, 26 Dec 2022 10:15:34 +0100 Subject: [PATCH] updated tor state --- states/tor/config.sls | 14 ++++++++++++++ states/tor/init.sls | 32 ++++---------------------------- states/tor/install.sls | 5 +++++ states/tor/service.sls | 12 ++++++++++++ 4 files changed, 35 insertions(+), 28 deletions(-) create mode 100644 states/tor/config.sls create mode 100644 states/tor/install.sls create mode 100644 states/tor/service.sls diff --git a/states/tor/config.sls b/states/tor/config.sls new file mode 100644 index 0000000..d0f77d3 --- /dev/null +++ b/states/tor/config.sls @@ -0,0 +1,14 @@ +--- +{%- from "tor/map.jinja" import tor with context %} +tor-config: + file.managed: + - name: /etc/tor/torrc + - source: salt://tor/torrc.j2 + - user: root + - group: root + - mode: "0660" + - template: jinja + - watch_in: + - service: tor-service + - require: + - pkg: tor-pkg diff --git a/states/tor/init.sls b/states/tor/init.sls index 1f7a383..383c46b 100644 --- a/states/tor/init.sls +++ b/states/tor/init.sls @@ -1,29 +1,5 @@ --- -{%- from "tor/map.jinja" import tor with context %} -tor-pkg: - pkg.latest: - - name: tor - -tor-config: - file.managed: - - name: /etc/tor/torrc - - source: salt://tor/torrc.j2 - - user: root - - group: root - - mode: "0660" - - template: jinja - - watch_in: - - service: tor-service - - require: - - pkg: tor-pkg - -tor-service: -{%- if tor.enabled %} - service.running: -{%- else %} - service.dead: -{%- endif %} - - name: tor - - enable: {{ tor.enabled }} - - require: - - pkg: tor-pkg \ No newline at end of file +include: + - .install + - .config + - .service diff --git a/states/tor/install.sls b/states/tor/install.sls new file mode 100644 index 0000000..aa5fe76 --- /dev/null +++ b/states/tor/install.sls @@ -0,0 +1,5 @@ +--- +{%- from "tor/map.jinja" import tor with context %} +tor-pkg: + pkg.installed: + - name: tor diff --git a/states/tor/service.sls b/states/tor/service.sls new file mode 100644 index 0000000..73194ce --- /dev/null +++ b/states/tor/service.sls @@ -0,0 +1,12 @@ +--- +{%- from "tor/map.jinja" import tor with context %} +tor-service: +{%- if tor.enabled %} + service.running: +{%- else %} + service.dead: +{%- endif %} + - name: tor + - enable: {{ tor.enabled }} + - require: + - pkg: tor-pkg