forked from saltstack-formulas/apt-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial support for apt conf management
- Add template file - Add pillar example
- Loading branch information
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% from "apt/map.jinja" import apt as apt_map with context %} | ||
{% set confd_dir = salt['pillar.get']('apt:confd_dir', apt_map.confd_dir) %} | ||
{% set clean_conf_d = salt['pillar.get']('apt:clean_conf_d', apt_map.clean_conf_d) %} | ||
{% set apt_conf = salt['pillar.get']('apt:conf', apt_map.conf) %} | ||
{{ confd_dir }}: | ||
file.directory: | ||
- mode: '0755' | ||
- user: root | ||
- group: root | ||
- clean: {{ clean_conf_d }} | ||
{% for file, contents in apt_conf|dictsort %} | ||
{{ confd_dir }}/{{ file }}: | ||
file.managed: | ||
- source: salt://apt/templates/conf.jinja | ||
- template: jinja | ||
- user: root | ||
- group: root | ||
- mode: 644 | ||
- context: | ||
data: {{ contents }} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{%- macro print(mname, mvalue) %} | ||
{%- if mvalue is string %} | ||
{{ mname }} "{{ mvalue }}"; | ||
{%- elif mvalue is sequence %} | ||
{{ mname }} { | ||
{%- for item in mvalue %} | ||
"{{ item }}"; | ||
{%- endfor %} | ||
}; | ||
{%- endif %} | ||
{%- endmacro -%} | ||
// This file is managed by salt | ||
{%- for opt, opt_data in data|dictsort -%} | ||
{%- if opt_data is string %} | ||
{{ opt }} "{{ opt_data }}"; | ||
{%- elif opt_data is mapping %} | ||
{{ opt }} | ||
{ | ||
{%- for name, value in opt_data|dictsort %} | ||
{{- print(name, value) }} | ||
{%- endfor %} | ||
}; | ||
{%- elif opt_data is sequence %} | ||
{{ opt }} { | ||
{%- for item in opt_data %} | ||
"{{ item }}"; | ||
{%- endfor %} | ||
}; | ||
{%- endif %} | ||
{%- endfor -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters