Skip to content

Commit

Permalink
Attempt to use a variable for whonix version
Browse files Browse the repository at this point in the history
Allow to override it from pillars just like others
  • Loading branch information
viq committed May 3, 2018
1 parent 857ee77 commit 4b7a07b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
6 changes: 3 additions & 3 deletions qvm/anon-whonix.sls
Expand Up @@ -26,7 +26,7 @@ include:
{% load_yaml as defaults -%}
name: anon-whonix
present:
- template: whonix-ws-14
- template: whonix-ws-{{ defaults.whonix_version }}
- label: red
prefs:
- netvm: sys-whonix
Expand All @@ -35,9 +35,9 @@ tags:
- add:
- anon-vm
require:
- pkg: template-whonix-ws-14
- pkg: template-whonix-ws-{{ defaults.whonix_version }}
- qvm: sys-whonix
- qvm: whonix-ws-dvm
- qvm: whonix-ws-{{ defaults.whonix_version }}-dvm
{%- endload %}

{{ load(defaults) }}
4 changes: 2 additions & 2 deletions qvm/sys-whonix.sls
Expand Up @@ -25,15 +25,15 @@ include:
{% load_yaml as defaults -%}
name: sys-whonix
present:
- template: whonix-gw-14
- template: whonix-gw-{{ defaults.whonix_version }}
- label: black
- mem: 500
prefs:
- netvm: sys-firewall
- provides-network: true
- autostart: true
require:
- pkg: template-whonix-gw-14
- pkg: template-whonix-gw-{{ defaults.whonix_version }}
- qvm: sys-firewall
{%- endload %}

Expand Down
8 changes: 4 additions & 4 deletions qvm/template-whonix-gw.sls
Expand Up @@ -11,20 +11,20 @@
# qubesctl state.sls qvm.template-whonix-gw dom0
##

template-whonix-gw-14:
template-whonix-gw-{{ defaults.whonix_version }}:
pkg.installed:
- name: qubes-template-whonix-gw-14
- name: qubes-template-whonix-gw-{{ defaults.whonix_version }}
- fromrepo: qubes-templates-community

whonix-gw-tag:
qvm.vm:
- name: whonix-gw-14
- name: whonix-gw-{{ defaults.whonix_version }}
- tags:
- present:
- whonix-updatevm
- features:
- enable:
- whonix-gw-14
- whonix-gw-{{ defaults.whonix_version }}

whonix-gw-update-policy:
file.prepend:
Expand Down
8 changes: 4 additions & 4 deletions qvm/template-whonix-ws.sls
Expand Up @@ -11,20 +11,20 @@
# qubesctl state.sls qvm.template-whonix-ws dom0
##

template-whonix-ws-14:
template-whonix-ws-{{ defaults.whonix_version }}:
pkg.installed:
- name: qubes-template-whonix-ws-14
- name: qubes-template-whonix-ws-{{ defaults.whonix_version }}
- fromrepo: qubes-templates-community

whonix-ws-tag:
qvm.vm:
- name: whonix-ws-14
- name: whonix-ws-{{ defaults.whonix_version }}
- tags:
- present:
- whonix-updatevm
- features:
- enable:
- whonix-ws-14
- whonix-ws-{{ defaults.whonix_version }}

whonix-ws-update-policy:
file.prepend:
Expand Down
3 changes: 3 additions & 0 deletions qvm/template.jinja
Expand Up @@ -101,6 +101,9 @@
{%- do defaults.update(pillar_data) %}
{%- set force = defaults.get('force', vm.get('force', False)) %}

{#- Set whonix version in single place #}
{% set whonix_version = salt['pillar.get']('qvm:whonix:version', '14') %}

{#- Only attempt to install the VM if it is missing (not installed) to prevent
# changing an existing configuration, unless ``force`` is True.
#}
Expand Down
10 changes: 5 additions & 5 deletions qvm/whonix-ws-dvm.sls
Expand Up @@ -25,29 +25,29 @@ include:
{% set gui_user = salt['cmd.shell']('groupmems -l -g qubes') %}

{% load_yaml as defaults -%}
name: whonix-ws-dvm
name: whonix-ws-{{ defaults.whonix_version }}-dvm
present:
- template: whonix-ws-14
- template: whonix-ws-{{ defaults.whonix_version }}
- label: red
prefs:
- netvm: sys-whonix
- template-for-dispvms: true
- default-dispvm: whonix-ws-dvm
- default-dispvm: whonix-ws-{{ defaults.whonix_version }}-dvm
tags:
- add:
- anon-vm
features:
- enable:
- appmenus-dispvm
require:
- pkg: template-whonix-ws-14
- pkg: template-whonix-ws-{{ defaults.whonix_version }}
- qvm: sys-whonix
{%- endload %}

qvm-appmenus --update whonix-ws-dvm:
cmd.run:
- runas: {{ gui_user }}
- onchanges:
- qvm: whonix-ws-dvm
- qvm: whonix-ws-{{ defaults.whonix_version }}-dvm

{{ load(defaults) }}

0 comments on commit 4b7a07b

Please sign in to comment.