mirror of
https://github.com/saltstack-formulas/packages-formula.git
synced 2025-04-17 10:10:27 +00:00
fix(states): deploy packages only if required
This commit is contained in:
parent
59c3288fb3
commit
c9fe187e16
9 changed files with 219 additions and 194 deletions
|
@ -1,8 +1,14 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
{% from "packages/map.jinja" import packages with context %}
|
{%- from "packages/map.jinja" import packages with context %}
|
||||||
|
|
||||||
{% set req_packages = packages.pkgs.required.pkgs + packages.archives.pkgs.required %}
|
{%- set wanted_archives = packages.archives.required.archives %}
|
||||||
|
{%- do wanted_archives.update( packages.archives.wanted ) %}
|
||||||
|
{%- set unwanted_archives = packages.archives.unwanted %}
|
||||||
|
|
||||||
|
{%- if wanted_archives or unwanted_archives %}
|
||||||
|
|
||||||
|
{%- set req_packages = packages.pkgs.required.pkgs + packages.archives.pkgs.required %}
|
||||||
include:
|
include:
|
||||||
- packages.pkgs
|
- packages.pkgs
|
||||||
|
|
||||||
|
@ -11,20 +17,16 @@ extend:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- pkgs: {{ req_packages | json }}
|
- pkgs: {{ req_packages | json }}
|
||||||
|
|
||||||
{% set wanted_archives = packages.archives.required.archives %}
|
|
||||||
{% do wanted_archives.update( packages.archives.wanted ) %}
|
|
||||||
{% set unwanted_archives = packages.archives.unwanted %}
|
|
||||||
|
|
||||||
# unwanted 'archive' software
|
# unwanted 'archive' software
|
||||||
{% for file_or_directory in unwanted_archives %}
|
{%- for file_or_directory in unwanted_archives %}
|
||||||
packages-archive-unwanted-{{ file_or_directory }}:
|
packages-archive-unwanted-{{ file_or_directory }}:
|
||||||
file.absent:
|
file.absent:
|
||||||
- name: {{ file_or_directory }}
|
- name: {{ file_or_directory }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
# wanted 'archive' software
|
# wanted 'archive' software
|
||||||
{% for package, archive in wanted_archives.items() %}
|
{%- for package, archive in wanted_archives.items() %}
|
||||||
{%- set archivename = archive.dl.source.split('/')[-1] %}
|
{%- set archivename = archive.dl.source.split('/')[-1] %}
|
||||||
|
|
||||||
packages-archive-wanted-target-{{ package }}-directory:
|
packages-archive-wanted-target-{{ package }}-directory:
|
||||||
file.directory:
|
file.directory:
|
||||||
|
@ -39,7 +41,7 @@ packages-archive-wanted-target-{{ package }}-directory:
|
||||||
- require_in:
|
- require_in:
|
||||||
- packages-archive-wanted-download-{{ package }}
|
- packages-archive-wanted-download-{{ package }}
|
||||||
|
|
||||||
{%- if 'format' in archive.dl and archive.dl.format in packages.archives.types %}
|
{%- if 'format' in archive.dl and archive.dl.format in packages.archives.types %}
|
||||||
|
|
||||||
packages-archive-wanted-download-{{ package }}:
|
packages-archive-wanted-download-{{ package }}:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
|
@ -48,7 +50,7 @@ packages-archive-wanted-download-{{ package }}:
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
|
|
||||||
{%- if 'hashsum' in archive.dl and archive.dl.hashsum %}
|
{%- if 'hashsum' in archive.dl and archive.dl.hashsum %}
|
||||||
{# see https://github.com/saltstack/salt/pull/41914 #}
|
{# see https://github.com/saltstack/salt/pull/41914 #}
|
||||||
|
|
||||||
packages-archive-wanted-{{ package }}-check-hashsum:
|
packages-archive-wanted-{{ package }}-check-hashsum:
|
||||||
module.run:
|
module.run:
|
||||||
|
@ -67,18 +69,18 @@ packages-archive-wanted-install-{{ package }}:
|
||||||
- source: file://{{ packages.tmpdir }}/{{ archivename }}
|
- source: file://{{ packages.tmpdir }}/{{ archivename }}
|
||||||
- name: {{ archive.dest }}/
|
- name: {{ archive.dest }}/
|
||||||
- archive_format: {{ archive.dl.format }}
|
- archive_format: {{ archive.dl.format }}
|
||||||
{%- if 'hashurl' in archive.dl and archive.dl.hashurl %}
|
{%- if 'hashurl' in archive.dl and archive.dl.hashurl %}
|
||||||
- source_hash: {{ archive.dl.hashurl }}
|
- source_hash: {{ archive.dl.hashurl }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- if 'options' in archive and archive.options %}
|
{%- if 'options' in archive and archive.options %}
|
||||||
- options: {{ archive.options }}
|
- options: {{ archive.options }}
|
||||||
- enforce_toplevel: {{ 'False' if 'strip-components' in archive.options else 'True' }}
|
- enforce_toplevel: {{ 'False' if 'strip-components' in archive.options else 'True' }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
- onlyif: test -d {{ archive.dest }}
|
- onlyif: test -d {{ archive.dest }}
|
||||||
- require:
|
- require:
|
||||||
- packages-archive-wanted-download-{{ package }}
|
- packages-archive-wanted-download-{{ package }}
|
||||||
|
|
||||||
{%- else %}
|
{%- else %}
|
||||||
|
|
||||||
packages-archive-wanted-download-{{ package }}:
|
packages-archive-wanted-download-{{ package }}:
|
||||||
file.managed:
|
file.managed:
|
||||||
|
@ -87,12 +89,13 @@ packages-archive-wanted-download-{{ package }}:
|
||||||
- mode: {{ '0755' if archive.dl.format in ('bin',) else '0644' if 'mode' not in archive else archive.mode }}
|
- mode: {{ '0755' if archive.dl.format in ('bin',) else '0644' if 'mode' not in archive else archive.mode }}
|
||||||
- user: {{ packages.rootuser if 'user' not in archive else archive.user }}
|
- user: {{ packages.rootuser if 'user' not in archive else archive.user }}
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
{%- if 'hashsum' in archive.dl and archive.dl.hashsum %}
|
{%- if 'hashsum' in archive.dl and archive.dl.hashsum %}
|
||||||
- source_hash: {{ archive.dl.hashsum }}
|
- source_hash: {{ archive.dl.hashsum }}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
- skip_verify: True
|
- skip_verify: True
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
|
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
{% from "packages/map.jinja" import packages with context %}
|
{%- from "packages/map.jinja" import packages with context %}
|
||||||
|
|
||||||
{% if grains['os'] == 'Windows' %}
|
{%- if grains['os'] == 'Windows' %}
|
||||||
|
|
||||||
{% if packages.chocolatey %}
|
{%- if packages.chocolatey %}
|
||||||
{% set req_states = packages.chocolatey.required.states %}
|
{%- set req_states = packages.chocolatey.required.states %}
|
||||||
{% set req_pkgs = packages.chocolatey.required.pkgs %}
|
{%- set req_pkgs = packages.chocolatey.required.pkgs %}
|
||||||
{% set wanted_chocolatey = packages.chocolatey.wanted %}
|
{%- set wanted_chocolatey = packages.chocolatey.wanted %}
|
||||||
{% set unwanted_chocolatey = packages.chocolatey.unwanted %}
|
{%- set unwanted_chocolatey = packages.chocolatey.unwanted %}
|
||||||
|
|
||||||
{% if req_states %}
|
{%- if wanted_chocolatey or unwanted_chocolatey %}
|
||||||
|
{%- if req_states %}
|
||||||
include:
|
include:
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- {{ dep }}
|
- {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
chocolatey_req_pkgs:
|
chocolatey_req_pkgs:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
|
@ -23,8 +24,8 @@ chocolatey_req_pkgs:
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
|
|
||||||
### CHOCOLATEY PACKAGES to install
|
### CHOCOLATEY PACKAGES to install
|
||||||
{% if wanted_chocolatey %}
|
{%- if wanted_chocolatey %}
|
||||||
{% for choco, settings in wanted_chocolatey.items() %}
|
{%- for choco, settings in wanted_chocolatey.items() %}
|
||||||
{{ choco }}:
|
{{ choco }}:
|
||||||
chocolatey.installed:
|
chocolatey.installed:
|
||||||
- name: {{ choco }}
|
- name: {{ choco }}
|
||||||
|
@ -37,17 +38,21 @@ chocolatey_req_pkgs:
|
||||||
- force_x86: {{ False if 'force_x86' not in settings else settings.force_x86 }}
|
- force_x86: {{ False if 'force_x86' not in settings else settings.force_x86 }}
|
||||||
- package_args: {{ '' if 'package_args' not in settings else settings.package_args }}
|
- package_args: {{ '' if 'package_args' not in settings else settings.package_args }}
|
||||||
- allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }}
|
- allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }}
|
||||||
{% endfor %}
|
- require:
|
||||||
{% endif %}
|
- pkg: chocolatey_req_pkgs
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
### CHOCOLATEY PACKAGES to uninstall
|
### CHOCOLATEY PACKAGES to uninstall
|
||||||
{% if unwanted_chocolatey %}
|
{%- if unwanted_chocolatey %}
|
||||||
{% for uchoco in unwanted_chocolatey %}
|
{%- for uchoco in unwanted_chocolatey %}
|
||||||
{{ uchoco }}:
|
{{ uchoco }}:
|
||||||
chocolatey.uninstalled:
|
chocolatey.uninstalled:
|
||||||
- name: {{ uchoco }}
|
- name: {{ uchoco }}
|
||||||
{% endfor %}
|
- require:
|
||||||
{% endif %}
|
- pkg: chocolatey_req_pkgs
|
||||||
{% endif %}
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
{% from "packages/map.jinja" import packages with context %}
|
|
||||||
|
|
||||||
{% set req_states = packages.gems.required.states %}
|
{#- Get the `tplroot` from `tpldir` #}
|
||||||
{% set req_pkgs = packages.gems.required.pkgs %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{% set wanted_gems = packages.gems.wanted %}
|
{%- from tplroot ~ "/map.jinja" import packages with context %}
|
||||||
{% set unwanted_gems = packages.gems.unwanted %}
|
|
||||||
|
|
||||||
{% if req_states %}
|
{%- set req_states = packages.gems.required.states %}
|
||||||
|
{%- set req_pkgs = packages.gems.required.pkgs %}
|
||||||
|
{%- set wanted_gems = packages.gems.wanted %}
|
||||||
|
{%- set unwanted_gems = packages.gems.unwanted %}
|
||||||
|
|
||||||
|
{%- if wanted_gems or unwanted_gems %}
|
||||||
|
{%- if req_states %}
|
||||||
include:
|
include:
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- {{ dep }}
|
- {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
### REQ PKGS (without these, some of the WANTED GEMS will fail to install)
|
### REQ PKGS (without these, some of the WANTED GEMS will fail to install)
|
||||||
gem_req_pkgs:
|
gem_req_pkgs:
|
||||||
|
@ -23,25 +27,28 @@ gem_req_pkgs:
|
||||||
### GEMS to install
|
### GEMS to install
|
||||||
# (requires the ruby/rubygem deb/rpm installed, either by the system or listed in
|
# (requires the ruby/rubygem deb/rpm installed, either by the system or listed in
|
||||||
# the required packages
|
# the required packages
|
||||||
{% for gm in wanted_gems %}
|
{%- for gm in wanted_gems %}
|
||||||
{{ gm }}:
|
{{ gm }}:
|
||||||
gem.installed:
|
gem.installed:
|
||||||
- require:
|
- require:
|
||||||
- pkg: gem_req_pkgs
|
- pkg: gem_req_pkgs
|
||||||
{% if req_states %}
|
{%- if req_states %}
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- sls: {{ dep }}
|
- sls: {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
{#- Not specific to Arch but needed for the newest versions of Ruby #}
|
{#- Not specific to Arch but needed for the newest versions of Ruby #}
|
||||||
{%- if grains.os_family == 'Arch' %}
|
{%- if grains.os_family == 'Arch' %}
|
||||||
- rdoc: True
|
- rdoc: True
|
||||||
- ri: True
|
- ri: True
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
{% for ugm in unwanted_gems %}
|
{%- for ugm in unwanted_gems %}
|
||||||
{{ ugm }}:
|
{{ ugm }}:
|
||||||
gem.removed
|
gem.removed:
|
||||||
{% endfor %}
|
- require:
|
||||||
|
- pkg: gem_req_pkgs
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=jinja
|
# vim: ft=jinja
|
||||||
|
|
||||||
{% import_yaml 'packages/defaults.yaml' as defaults %}
|
{%- import_yaml 'packages/defaults.yaml' as defaults %}
|
||||||
{% import_yaml 'packages/osfamilymap.yaml' as osfamilymap %}
|
{%- import_yaml 'packages/osfamilymap.yaml' as osfamilymap %}
|
||||||
{% import_yaml 'packages/osmap.yaml' as osmap %}
|
{%- import_yaml 'packages/osmap.yaml' as osmap %}
|
||||||
|
|
||||||
{% set packages = salt['grains.filter_by'](
|
{%- set packages = salt['grains.filter_by'](
|
||||||
defaults,
|
defaults,
|
||||||
merge = salt['grains.filter_by'](
|
merge = salt['grains.filter_by'](
|
||||||
osfamilymap,
|
osfamilymap,
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
{% from "packages/map.jinja" import packages with context %}
|
{%- from "packages/map.jinja" import packages with context %}
|
||||||
|
|
||||||
{% set req_states = packages.npms.required.states %}
|
{%- set req_states = packages.npms.required.states %}
|
||||||
{% set req_pkgs = packages.npms.required.pkgs %}
|
{%- set req_pkgs = packages.npms.required.pkgs %}
|
||||||
{% set wanted_npms = packages.npms.wanted %}
|
{%- set wanted_npms = packages.npms.wanted %}
|
||||||
{% set unwanted_npms = packages.npms.unwanted %}
|
{%- set unwanted_npms = packages.npms.unwanted %}
|
||||||
|
|
||||||
{% if req_states %}
|
|
||||||
include:
|
|
||||||
{% for dep in req_states %}
|
|
||||||
- {{ dep }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
# As we depend on npm installed, if this state file is invoked every time
|
# As we depend on npm installed, if this state file is invoked every time
|
||||||
# if will fail with 'npm not found'. This condition makes sure it's run
|
# if will fail with 'npm not found'. This condition makes sure it's run
|
||||||
# only when explicitly asking for adding/removing npms
|
# only when explicitly asking for adding/removing npms
|
||||||
{% if wanted_npms or unwanted_npms %}
|
{%- if wanted_npms or unwanted_npms %}
|
||||||
|
|
||||||
|
{%- if req_states %}
|
||||||
|
include:
|
||||||
|
{%- for dep in req_states %}
|
||||||
|
- {{ dep }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
### REQ PKGS (without these, some of the WANTED NPMS will fail to install)
|
### REQ PKGS (without these, some of the WANTED NPMS will fail to install)
|
||||||
npm_req_pkgs:
|
npm_req_pkgs:
|
||||||
|
@ -28,7 +28,7 @@ npm_req_pkgs:
|
||||||
# (requires the npm binary installed, either by the system or listed in
|
# (requires the npm binary installed, either by the system or listed in
|
||||||
# the required packages
|
# the required packages
|
||||||
|
|
||||||
{% if packages.npms.dir is defined %}
|
{%- if packages.npms.dir is defined %}
|
||||||
npms_dir:
|
npms_dir:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ packages.npms.dir }}
|
- name: {{ packages.npms.dir }}
|
||||||
|
@ -36,41 +36,42 @@ npms_dir:
|
||||||
- group: {{ packages.rootuser if 'group' not in packages.npms else packages.npms.group }}
|
- group: {{ packages.rootuser if 'group' not in packages.npms else packages.npms.group }}
|
||||||
- mode: {{ '0755' if 'mode' not in packages.npms else packages.npms.mode }}
|
- mode: {{ '0755' if 'mode' not in packages.npms else packages.npms.mode }}
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
wanted_npms:
|
wanted_npms:
|
||||||
npm.installed:
|
npm.installed:
|
||||||
- pkgs: {{ wanted_npms | json }}
|
- pkgs: {{ wanted_npms | json }}
|
||||||
{% if packages.npms.dir is defined %}
|
{%- if packages.npms.dir is defined %}
|
||||||
- dir: {{ packages.npms.dir }}
|
- dir: {{ packages.npms.dir }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if packages.npms.user is defined %}
|
{%- if packages.npms.user is defined %}
|
||||||
- user: {{ packages.npms.user }}
|
- user: {{ packages.npms.user }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if packages.npms.registry is defined %}
|
{%- if packages.npms.registry is defined %}
|
||||||
- registry: {{ packages.npms.registry }}
|
- registry: {{ packages.npms.registry }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if packages.npms.env is defined %}
|
{%- if packages.npms.env is defined %}
|
||||||
- env: {{ packages.npms.env | json }}
|
- env: {{ packages.npms.env | json }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if packages.npms.force_reinstall is defined %}
|
{%- if packages.npms.force_reinstall is defined %}
|
||||||
- force_reinstall: {{ packages.npms.force_reinstall }}
|
- force_reinstall: {{ packages.npms.force_reinstall }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- require:
|
- require:
|
||||||
{% if packages.npms.dir is defined %}
|
{%- if packages.npms.dir is defined %}
|
||||||
- file: npms_dir
|
- file: npms_dir
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- pkg: npm_req_pkgs
|
- pkg: npm_req_pkgs
|
||||||
{% if req_states %}
|
{%- if req_states %}
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- sls: {{ dep }}
|
- sls: {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
|
|
||||||
{% for upn in unwanted_npms %}
|
{%- for upn in unwanted_npms %}
|
||||||
{{ upn }}:
|
{{ upn }}:
|
||||||
npm.removed
|
npm.removed:
|
||||||
{% endfor %}
|
- require:
|
||||||
|
- pkg: npm_req_pkgs
|
||||||
{% endif %}
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
|
@ -5,25 +5,27 @@
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import packages with context %}
|
{%- from tplroot ~ "/map.jinja" import packages with context %}
|
||||||
|
|
||||||
{% set req_states = packages.pips.required.states %}
|
{%- set req_states = packages.pips.required.states %}
|
||||||
{% set req_pkgs = packages.pips.required.pkgs %}
|
{%- set req_pkgs = packages.pips.required.pkgs %}
|
||||||
{% set wanted_pips = packages.pips.wanted %}
|
{%- set wanted_pips = packages.pips.wanted %}
|
||||||
{% set unwanted_pips = packages.pips.unwanted %}
|
{%- set unwanted_pips = packages.pips.unwanted %}
|
||||||
{% set pip_config = packages.pips.config %}
|
{%- set pip_config = packages.pips.config %}
|
||||||
|
|
||||||
{% if req_states %}
|
{%- if wanted_pips or unwanted_pips %}
|
||||||
|
|
||||||
|
{%- if req_states %}
|
||||||
include:
|
include:
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- {{ dep }}
|
- {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
### REQ PKGS (without these, some of the WANTED PIPS will fail to install)
|
### REQ PKGS (without these, some of the WANTED PIPS will fail to install)
|
||||||
pip_req_pkgs:
|
pip_req_pkgs:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- pkgs: {{ req_pkgs | json }}
|
- pkgs: {{ req_pkgs | json }}
|
||||||
|
|
||||||
{% if pip_config %}
|
{%- if pip_config %}
|
||||||
pip_config:
|
pip_config:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: /etc/pip.conf
|
- name: /etc/pip.conf
|
||||||
|
@ -32,41 +34,46 @@ pip_config:
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- context:
|
- context:
|
||||||
config: {{ pip_config|json }}
|
config: {{ pip_config|json }}
|
||||||
{% endif %}
|
- require:
|
||||||
|
- pkg: pip_req_pkgs
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
### PYTHON PKGS to install using PIP
|
### PYTHON PKGS to install using PIP
|
||||||
# (requires the python-pip deb/rpm installed, either by the system or listed in
|
# (requires the python-pip deb/rpm installed, either by the system or listed in
|
||||||
# the required packages
|
# the required packages
|
||||||
{% for pn in wanted_pips %}
|
{%- for pn in wanted_pips %}
|
||||||
packages pips install {{ pn }}:
|
packages pips install {{ pn }}:
|
||||||
{%- if grains.os_family in ('Suse',) %} ##workaround https://github.com/saltstack-formulas/docker-formula/issues/198
|
{%- if grains.os_family in ('Suse',) %} ##workaround https://github.com/saltstack-formulas/docker-formula/issues/198
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: /usr/bin/pip install {{ pn }}
|
- name: /usr/bin/pip install {{ pn }}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
pip.installed:
|
pip.installed:
|
||||||
- name: {{ pn }}
|
- name: {{ pn }}
|
||||||
- reload_modules: true
|
- reload_modules: true
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
- require:
|
- require:
|
||||||
- pkg: pip_req_pkgs
|
- pkg: pip_req_pkgs
|
||||||
{% if req_states %}
|
{%- if req_states %}
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- sls: {{ dep }}
|
- sls: {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if pip_config %}
|
{%- if pip_config %}
|
||||||
- file: pip_config
|
- file: pip_config
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
{% for upn in unwanted_pips %}
|
{%- for upn in unwanted_pips %}
|
||||||
packages pips remove {{ upn }}:
|
packages pips remove {{ upn }}:
|
||||||
{%- if grains.os_family in ('Suse',) %}
|
{%- if grains.os_family in ('Suse',) %}
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: /usr/bin/pip uninstall {{ upn }}
|
- name: /usr/bin/pip uninstall {{ upn }}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
pip.removed:
|
pip.removed:
|
||||||
- name: {{ upn }}
|
- name: {{ upn }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% endfor %}
|
- require:
|
||||||
|
- pkg: pip_req_pkgs
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
|
@ -1,72 +1,74 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{% from "packages/map.jinja" import packages with context %}
|
{%- from "packages/map.jinja" import packages with context %}
|
||||||
|
|
||||||
{% set req_states = packages.pkgs.required.states %}
|
{%- set req_states = packages.pkgs.required.states %}
|
||||||
{% set req_packages = packages.pkgs.required.pkgs %}
|
{%- set req_packages = packages.pkgs.required.pkgs %}
|
||||||
{% set held_packages = packages.pkgs.held %}
|
{%- set held_packages = packages.pkgs.held %}
|
||||||
{% set wanted_packages = packages.pkgs.wanted %}
|
{%- set wanted_packages = packages.pkgs.wanted %}
|
||||||
{% set unwanted_packages = packages.pkgs.unwanted %}
|
{%- set unwanted_packages = packages.pkgs.unwanted %}
|
||||||
|
|
||||||
{% if req_states %}
|
{%- if held_packages or wanted_packages %}
|
||||||
|
{%- if req_states %}
|
||||||
include:
|
include:
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- {{ dep }}
|
- {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
### PRE-REQ PKGS (without these, some of the WANTED PKGS will fail to install)
|
### PRE-REQ PKGS (without these, some of the WANTED PKGS will fail to install)
|
||||||
pkg_req_pkgs:
|
pkg_req_pkgs:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- pkgs: {{ req_packages | json }}
|
- pkgs: {{ req_packages | json }}
|
||||||
{% if req_states %}
|
{%- if req_states %}
|
||||||
- require:
|
- require:
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- sls: {{ dep }}
|
- sls: {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
|
|
||||||
{% if held_packages != {} %}
|
{%- if held_packages != {} %}
|
||||||
held_pkgs:
|
held_pkgs:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
{% if held_packages is mapping %}
|
{%- if held_packages is mapping %}
|
||||||
- pkgs:
|
- pkgs:
|
||||||
{% for p, v in held_packages.items() %}
|
{%- for p, v in held_packages.items() %}
|
||||||
- {{ p }}: {{ v }}
|
- {{ p }}: {{ v }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% else %}
|
{%- else %}
|
||||||
- pkgs: {{ held_packages | json }}
|
- pkgs: {{ held_packages | json }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if grains['os_family'] not in ['Suse'] %}
|
{%- if grains['os_family'] not in ['Suse'] %}
|
||||||
- hold: true
|
- hold: true
|
||||||
- update_holds: true
|
- update_holds: true
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- require:
|
- require:
|
||||||
- pkg: pkg_req_pkgs
|
- pkg: pkg_req_pkgs
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- sls: {{ dep }}
|
- sls: {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
wanted_pkgs:
|
wanted_pkgs:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- pkgs: {{ wanted_packages | json }}
|
- pkgs: {{ wanted_packages | json }}
|
||||||
{% if grains['os_family'] not in ['Suse'] %}
|
{%- if grains['os_family'] not in ['Suse'] %}
|
||||||
- hold: false
|
- hold: false
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- require:
|
- require:
|
||||||
- pkg: pkg_req_pkgs
|
- pkg: pkg_req_pkgs
|
||||||
{% if req_states %}
|
{%- if req_states %}
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- sls: {{ dep }}
|
- sls: {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
|
|
||||||
unwanted_pkgs:
|
unwanted_pkgs:
|
||||||
pkg.purged:
|
pkg.purged:
|
||||||
- pkgs: {{ unwanted_packages | json }}
|
- pkgs: {{ unwanted_packages | json }}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{% from "packages/map.jinja" import packages with context %}
|
{%- from "packages/map.jinja" import packages with context %}
|
||||||
|
|
||||||
{% set wanted_rem_pkgs = packages.remote_pkgs %}
|
{%- set wanted_rem_pkgs = packages.remote_pkgs %}
|
||||||
|
|
||||||
### REMOTE PKGS to install directly from a remote URL. Must be a deb/rpm file
|
### REMOTE PKGS to install directly from a remote URL. Must be a deb/rpm file
|
||||||
{% if wanted_rem_pkgs != {} %}
|
{%- if wanted_rem_pkgs %}
|
||||||
remote_packages:
|
remote_packages:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- sources:
|
- sources:
|
||||||
{% for package, url in wanted_rem_pkgs.items() %}
|
{%- for package, url in wanted_rem_pkgs.items() %}
|
||||||
- {{ package }}: {{ url }}
|
- {{ package }}: {{ url }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
{% from "packages/map.jinja" import packages with context %}
|
{%- from "packages/map.jinja" import packages with context %}
|
||||||
|
|
||||||
# As we are 'extend'ing pkg_req_pkgs and unwanted_pkgs, we need to concatenate
|
# As we are 'extend'ing pkg_req_pkgs and unwanted_pkgs, we need to concatenate
|
||||||
# the attributes correctly (see #17)
|
# the attributes correctly (see #17)
|
||||||
{% set req_packages = packages.pkgs.required.pkgs + packages.snaps.packages %}
|
{%- set req_packages = packages.pkgs.required.pkgs + packages.snaps.packages %}
|
||||||
{% set req_states = packages.pkgs.required.states + packages.snaps.required.states %}
|
{%- set req_states = packages.pkgs.required.states + packages.snaps.required.states %}
|
||||||
{% set unwanted_packages = packages.pkgs.unwanted + packages.snaps.collides %}
|
{%- set unwanted_packages = packages.pkgs.unwanted + packages.snaps.collides %}
|
||||||
|
|
||||||
{% set wanted_snaps = packages.snaps.wanted %}
|
{%- set wanted_snaps = packages.snaps.wanted %}
|
||||||
{% set classic_snaps = packages.snaps.classic %}
|
{%- set classic_snaps = packages.snaps.classic %}
|
||||||
{% set unwanted_snaps = packages.snaps.unwanted %}
|
{%- set unwanted_snaps = packages.snaps.unwanted %}
|
||||||
|
|
||||||
{%- if packages.snaps.packages %}
|
{%- if packages.snaps.packages %}
|
||||||
{% if wanted_snaps or classic_snaps or unwanted_snaps %}
|
{%- if wanted_snaps or classic_snaps or unwanted_snaps %}
|
||||||
|
|
||||||
### REQ PKGS (without this, SNAPS can fail to install/uninstall)
|
### REQ PKGS (without this, SNAPS can fail to install/uninstall)
|
||||||
include:
|
include:
|
||||||
- packages.pkgs
|
- packages.pkgs
|
||||||
{% if req_states %}
|
{%- if req_states %}
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- {{ dep }}
|
- {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
extend:
|
extend:
|
||||||
unwanted_pkgs:
|
unwanted_pkgs:
|
||||||
|
@ -32,15 +32,15 @@ extend:
|
||||||
pkg_req_pkgs:
|
pkg_req_pkgs:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- pkgs: {{ req_packages | json }}
|
- pkgs: {{ req_packages | json }}
|
||||||
{% if req_states %}
|
{%- if req_states %}
|
||||||
- require:
|
- require:
|
||||||
{% for dep in req_states %}
|
{%- for dep in req_states %}
|
||||||
- sls: {{ dep }}
|
- sls: {{ dep }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
|
|
||||||
{% if packages.snaps.symlink %}
|
{%- if packages.snaps.symlink %}
|
||||||
{# classic confinement requires snaps under /snap or symlink from #}
|
{# classic confinement requires snaps under /snap or symlink from #}
|
||||||
{# /snap to /var/lib/snapd/snap #}
|
{# /snap to /var/lib/snapd/snap #}
|
||||||
packages-snap-classic-symlink:
|
packages-snap-classic-symlink:
|
||||||
|
@ -51,9 +51,9 @@ packages-snap-classic-symlink:
|
||||||
- require:
|
- require:
|
||||||
- pkg: pkg_req_pkgs
|
- pkg: pkg_req_pkgs
|
||||||
- pkg: unwanted_pkgs
|
- pkg: unwanted_pkgs
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{% for snap in packages.snaps.service %}
|
{%- for snap in packages.snaps.service %}
|
||||||
packages-{{ snap }}-service:
|
packages-{{ snap }}-service:
|
||||||
service.running:
|
service.running:
|
||||||
- name: {{ snap }}
|
- name: {{ snap }}
|
||||||
|
@ -61,10 +61,10 @@ packages-{{ snap }}-service:
|
||||||
- require:
|
- require:
|
||||||
- pkg: pkg_req_pkgs
|
- pkg: pkg_req_pkgs
|
||||||
- pkg: unwanted_pkgs
|
- pkg: unwanted_pkgs
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
### SNAPS to install
|
### SNAPS to install
|
||||||
{% for snap in wanted_snaps %}
|
{%- for snap in wanted_snaps %}
|
||||||
packages-snapd-{{ snap }}-wanted:
|
packages-snapd-{{ snap }}-wanted:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: snap install {{ snap }}
|
- name: snap install {{ snap }}
|
||||||
|
@ -74,10 +74,10 @@ packages-snapd-{{ snap }}-wanted:
|
||||||
- pkg: pkg_req_pkgs
|
- pkg: pkg_req_pkgs
|
||||||
- pkg: unwanted_pkgs
|
- pkg: unwanted_pkgs
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
### SNAPS to install in classic mode
|
### SNAPS to install in classic mode
|
||||||
{% for snap in classic_snaps %}
|
{%- for snap in classic_snaps %}
|
||||||
packages-snapd-{{ snap }}-classic:
|
packages-snapd-{{ snap }}-classic:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: snap install --classic {{ snap }}
|
- name: snap install --classic {{ snap }}
|
||||||
|
@ -87,10 +87,10 @@ packages-snapd-{{ snap }}-classic:
|
||||||
- pkg: pkg_req_pkgs
|
- pkg: pkg_req_pkgs
|
||||||
- pkg: unwanted_pkgs
|
- pkg: unwanted_pkgs
|
||||||
- retry: {{ packages.retry_options|json }}
|
- retry: {{ packages.retry_options|json }}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
### SNAPS to uninstall
|
### SNAPS to uninstall
|
||||||
{% for snap in unwanted_snaps %}
|
{%- for snap in unwanted_snaps %}
|
||||||
packages-snapd-{{ snap }}-unwanted:
|
packages-snapd-{{ snap }}-unwanted:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: snap remove {{ snap }}
|
- name: snap remove {{ snap }}
|
||||||
|
@ -99,7 +99,7 @@ packages-snapd-{{ snap }}-unwanted:
|
||||||
- require:
|
- require:
|
||||||
- pkg: pkg_req_pkgs
|
- pkg: pkg_req_pkgs
|
||||||
- pkg: unwanted_pkgs
|
- pkg: unwanted_pkgs
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue