updated apt state

This commit is contained in:
Paul 2021-09-25 16:06:38 +02:00
parent b28cc4c7c0
commit 86ba135f3a
4 changed files with 28 additions and 30 deletions

View File

@ -1,3 +0,0 @@
{%- if salt['pillar.get']('apt-proxy:name') != "None" %}
Acquire::http { proxy "http://{{salt['pillar.get']('apt-proxy:name')}}:{{ salt['pillar.get']('apt-proxy:port')}}" }
{%- endif %}

13
states/apt/defaults.yaml Normal file
View File

@ -0,0 +1,13 @@
---
apt:
config: {}
# apt:
# config:
# 10proxy:
# content:
# - Acquire::http::Proxy "http://proxy:8000";
# - Acquire::https::Proxy "DIRECT";
# 99unauth:
# content:
# - APT::Get::AllowUnauthenticated "true";

View File

@ -1,28 +1,11 @@
--- ---
apt-unauth: {%- from "apt/map.jinja" import apt with context %}
file.append: {% for k, v in apt.config.items() -%}
- name: /etc/apt/apt.conf.d/99-unauth apt-proxy-{{ k }}:
- text: 'APT::Get::AllowUnauthenticated "true";' file.managed:
- name: /etc/apt/apt.conf.d/{{ k }}
apt-aptitude-install: - user: root
pkg.latest: - group: root
- pkgs: - mode: 0644
- aptitude - contents: {{ v.content }}
- apt-transport-https {% endfor -%}
#
# apt-upgrade:
# pkg.uptodate:
# - refresh: true
#
#apt-cacher-ng-proxy:
# file.managed:
# - name: /etc/apt/apt.conf.d/10proxy
# - source: salt://apt/10proxy.j2
# - user: root
# - group: root
# - mode: 0644
# - template: jinja
#
# apt-cacher-ng-proxy-delete:
# file.absent:
# - name: /etc/apt/apt.conf.d/10proxy

5
states/apt/map.jinja Normal file
View File

@ -0,0 +1,5 @@
{%- import_yaml "apt/defaults.yaml" as default_settings %}
{%- set defaults = salt['grains.filter_by'](default_settings, default='apt') %}
{%- set apt = salt['pillar.get']('apt', default=defaults, merge=True) %}