From 9bd83adf8b543ebb653c98ac91ace7a1911a26ef Mon Sep 17 00:00:00 2001 From: = Date: Wed, 16 Nov 2022 08:25:02 +0100 Subject: [PATCH] cleaned up whats moved to lib.sls --- podman/containers.sls | 60 ------------------------------------------- podman/firewalld.sls | 20 --------------- 2 files changed, 80 deletions(-) delete mode 100644 podman/containers.sls delete mode 100644 podman/firewalld.sls diff --git a/podman/containers.sls b/podman/containers.sls deleted file mode 100644 index 7111cb3..0000000 --- a/podman/containers.sls +++ /dev/null @@ -1,60 +0,0 @@ -{% set user = salt['pillar.get']('podman:user', 'root') %} -{% set home = salt['user.info'](user).home %} -{% set group = salt['pillar.get']('podman:group', 'root') %} - - - -{% for name, args in salt['pillar.get']('containers', {} ).items() %} - -Create container manage file for {{ name }}: - file.managed: - - name: "{{ home }}/bin/{{ name }}.sh" - - source: salt://podman/files/container.sh.jinja - - template: jinja - - user: {{ user }} - - group: {{ group }} - - mode: "0750" - - context: - container: {{ name }} - args: {{ args }} - -{% if args['volumes'] is defined %} -{% for volume, mount in args['volumes'].items() %} -Create {{ volume }} volume for {{ name }}: - cmd.run: - - name: podman volume create {{ name }}-{{ volume }} - - runas: {{ user }} - - unless: podman volume exists {{ name }}-{{ volume }} -{% endfor %} -{% endif %} - -Create container {{ name }}: - cmd.run: - - name: "{{ home }}/bin/{{ name }}.sh --create" - - runas: {{ user }} - - unless: podman container exists {{ name }} - -Create container {{ name }} unit file: - cmd.run: - - name: podman generate systemd --name {{ name }} > {{ home }}/.config/systemd/user/{{ name }}.service - - runas: {{ user }} - - onchanges: - - cmd: Create container {{ name }} - -Run user daemon reload for {{ name }} unit: - cmd.run: - - name: systemctl --user daemon-reload - - runas: {{ user }} - - onchanges: - - cmd: Create container {{ name }} unit file - -start container {{ name }}: - cmd.run: - - name: "{{ home }}/bin/{{ name }}.sh --start" - - runas: {{ user }} - - unless: "{{ home }}/bin/{{ name }}.sh --is-running" - - onchanges: - - cmd: Run user daemon reload for {{ name }} unit - - -{% endfor %} diff --git a/podman/firewalld.sls b/podman/firewalld.sls deleted file mode 100644 index 0b98ca1..0000000 --- a/podman/firewalld.sls +++ /dev/null @@ -1,20 +0,0 @@ -{% set zone = salt['pillar.get']('containers:zone', 'public') %} - -{% for name, args in salt['pillar.get']('containers', {} ).items() %} -{% if args['ports'] is defined %} - -Defining firewalld service for {{ name }}: - firewalld.service: - - name: {{ name }} - - ports: - {%- for port in args['ports'] %} - - {{ port['host'] }}/tcp - {%- endfor %} - -adding service {{ name }} to {{ zone }} zone: - firewalld.present: - - name: {{ zone }} - - services: - - {{ name }} -{% endif %} -{% endfor %}