From 2c301c8e9eefc5c16991336496aed3cd45b573a5 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 4 Feb 2023 19:54:02 +0100 Subject: [PATCH] updated docker state --- states/docker/defaults.yaml | 2 +- states/docker/init.sls | 3 ++- states/docker/install.sls | 6 +++--- states/docker/map.jinja | 5 ++--- states/docker/prune.sls | 5 +++++ 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 states/docker/prune.sls diff --git a/states/docker/defaults.yaml b/states/docker/defaults.yaml index 505d603..80b8d67 100644 --- a/states/docker/defaults.yaml +++ b/states/docker/defaults.yaml @@ -9,7 +9,7 @@ docker: - python3-cryptography pip_pkgs: - docker==5.0.3 - - docker-compose + - docker-compose==1.29.2 daemon: config: storage-driver: overlay2 diff --git a/states/docker/init.sls b/states/docker/init.sls index fc311f7..5f9bb4d 100644 --- a/states/docker/init.sls +++ b/states/docker/init.sls @@ -4,4 +4,5 @@ include: - .install - .config - .service - - .containers \ No newline at end of file + - .containers + - .prune diff --git a/states/docker/install.sls b/states/docker/install.sls index 3e1ddc6..ae9724d 100644 --- a/states/docker/install.sls +++ b/states/docker/install.sls @@ -4,8 +4,8 @@ docker-pkgs: pkg.installed: - pkgs: {{ docker.pkgs }} -docker-pip-pkgs: +{%- for pkg in docker.pip_pkgs %} +docker-pip-{{ pkg }}: pip.installed: -{%- for pip in docker.pip_pkgs %} - - name: {{ pip }} + - name: {{ pkg }} {%- endfor %} diff --git a/states/docker/map.jinja b/states/docker/map.jinja index 5b076cc..c6d319d 100644 --- a/states/docker/map.jinja +++ b/states/docker/map.jinja @@ -1,6 +1,5 @@ {%- import_yaml "docker/defaults.yaml" as default_settings -%} -{%- set defaults = salt['grains.filter_by'](default_settings, default='docker') --%} +{%- set defaults = salt['grains.filter_by'](default_settings, default='docker') -%} -{%- set docker = salt['pillar.get']('docker', default=defaults, merge=True) -%} \ No newline at end of file +{%- set docker = salt['pillar.get']('docker', default=defaults, merge=True) -%} diff --git a/states/docker/prune.sls b/states/docker/prune.sls new file mode 100644 index 0000000..afe4990 --- /dev/null +++ b/states/docker/prune.sls @@ -0,0 +1,5 @@ +--- +docker.prune: + module.run: + - docker.prune: + - images: true