This repository has been archived on 2023-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
salt-states_old/podman/init.sls

60 lines
1.5 KiB
Plaintext

{% set user = salt['pillar.get']('podman:user', 'root') %}
{% set home = salt['user.info'](user).home %}
Install packages needed for podman:
pkg.installed:
- pkgs:
- podman
Set linger for user {{ user }}:
cmd.run:
- name: loginctl enable-linger {{ user }}
- unless: test -e /var/lib/systemd/linger/{{ user }}
Copy check image update script:
file.managed:
- name: {{ home }}/bin/check_image_updates.sh
- source: salt://podman/files/check_image_updates.sh.jinja
- template: jinja
- user: {{ user }}
- group: {{ user }}
- mode: 0700
Create check image update service:
file.managed:
- name: /etc/systemd/system/check_image_updates.service
- source: salt://podman/files/check_image_updates.service.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
Create check image update timer:
file.managed:
- name: /etc/systemd/system/check_image_updates.timer
- source: salt://podman/files/check_image_updates.timer.jinja
- template: jinja
- user: root
- group: root
- mode: "0644"
Systemd daemon reload for image update:
cmd.run:
- name: systemctl daemon-reload
- onchanges:
- file: Create check image update service
- file: Create check image update timer
Start check image update timer:
service.running:
- name: check_image_updates.timer
- enable: True
{% if pillar.containers is defined %}
include:
{%- for container, args in pillar.containers.items() %}
- podman.{{ container }}
{%- endfor %}
{%- endif %}