File tree 4 files changed +92
-1
lines changed
4 files changed +92
-1
lines changed Original file line number Diff line number Diff line change
1
+ {% from " apt/map.jinja" import apt as apt_map with context % }
2
+ {% set remove_apt_conf = salt[' pillar.get' ](' apt:remove_apt_conf' , apt_map.remove_apt_conf) % }
3
+ {% set confd_dir = salt[' pillar.get' ](' apt:confd_dir' , apt_map.confd_dir) % }
4
+ {% set clean_apt_conf_d = salt[' pillar.get' ](' apt:clean_apt_conf_d' , apt_map.clean_apt_conf_d) % }
5
+ {% set apt_conf_d = salt[' pillar.get' ](' apt:apt_conf_d' , apt_map.apt_conf_d) % }
6
+
7
+ / etc/ apt/ apt.conf:
8
+ file .managed:
9
+ - mode: ' 0644'
10
+ - user: root
11
+ - group: root
12
+ {% if remove_apt_conf % }
13
+ - contents: ' '
14
+ - contents_newline: False
15
+ {% else % }
16
+ - replace: False
17
+ {% endif % }
18
+
19
+ {{ confd_dir }}:
20
+ file .directory:
21
+ - mode: 755
22
+ - user: root
23
+ - group: root
24
+ - clean: {{ clean_apt_conf_d }}
25
+
26
+ {% for file , contents in apt_conf_d| dictsort % }
27
+ {{ confd_dir }}/ {{ file }}:
28
+ file .managed:
29
+ - source: salt:// apt/ templates/ apt_conf.jinja
30
+ - template: jinja
31
+ - user: root
32
+ - group: root
33
+ - mode: 644
34
+ - context:
35
+ data: {{ contents }}
36
+ {% endfor % }
Original file line number Diff line number Diff line change 14
14
'preferences' : {},
15
15
'remove_preferences' : false ,
16
16
'clean_preferences_d' : false ,
17
+ 'remove_apt_conf' : false ,
18
+ 'clean_apt_conf_d' : false ,
19
+ 'apt_conf_d' : {},
17
20
'default_keyserver' : 'pool.sks-keyservers.net' ,
18
21
'default_url' : 'http://deb.debian.org/debian/' ,
19
22
'default_keyring_package' : 'debian-archive-keyring' ,
30
33
'arch' : arch ,
31
34
'comps' : ['main' ],
32
35
},
33
- },
36
+ },
34
37
},
35
38
}, merge =salt ['pillar.get' ]('apt:lookup' ), default ='Debian' ) %}
Original file line number Diff line number Diff line change
1
+ {% - macro print (mname , mvalue ) %}
2
+ {% - if mvalue is string %}
3
+ {{ mname }} "{{ mvalue }}";
4
+ {% - elif mvalue is sequence %}
5
+ {{ mname }} {
6
+ {% - for item in mvalue %}
7
+ "{{ item }}";
8
+ {% - endfor %}
9
+ };
10
+ {% - endif %}
11
+ {% - endmacro -%}
12
+ // This file is managed by salt
13
+ {% - for opt , opt_data in data |dictsort -%}
14
+ {% - if opt_data is string %}
15
+ {{ opt }} "{{ opt_data }}";
16
+ {% - elif opt_data is mapping %}
17
+ {{ opt }}
18
+ {
19
+ {% - for name , value in opt_data |dictsort %}
20
+ {{- print(name, value) }}
21
+ {% - endfor %}
22
+ };
23
+ {% - elif opt_data is sequence %}
24
+ {{ opt }} {
25
+ {% - for item in opt_data %}
26
+ "{{ item }}";
27
+ {% - endfor %}
28
+ };
29
+ {% - endif %}
30
+ {% - endfor -%}
Original file line number Diff line number Diff line change 8
8
remove_preferences: true
9
9
clean_preferences_d: true
10
10
11
+ apt_conf_d:
12
+ 30release:
13
+ 'APT::Default-Release': stable
14
+ '40dpkg-options':
15
+ 'Dpkg::Options':
16
+ - '--force-confdef'
17
+ - '--force-confold'
18
+ 60proxy:
19
+ 'Acquire::ftp':
20
+ Proxy: "ftp://127.0.0.1/"
21
+ 'Proxy::http.us.debian.org': DIRECT
22
+ ProxyLogin:
23
+ - "USER $(PROXY_USER)"
24
+ - "PASS $(PROXY_PASS)"
25
+ - "USER $(SITE_USER)@$(SITE):$(SITE_PORT)"
26
+ - "PASS $(SITE_PASS)"
27
+ DSelect:
28
+ Clean: auto
29
+ Options: -f
30
+ UpdateOptions: ""
31
+ PromptAfterUpdate: "no"
32
+
11
33
unattended:
12
34
allowed_origins:
13
35
- origin1
You can’t perform that action at this time.
0 commit comments