From 3e9cf6f5ed97731f5fa42a16494124d74f4fdc85 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 26 Oct 2016 13:08:46 +0200 Subject: [PATCH] Adding debian/repo.sls --- debian/repo.sls | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 debian/repo.sls diff --git a/debian/repo.sls b/debian/repo.sls new file mode 100644 index 0000000..6a135cd --- /dev/null +++ b/debian/repo.sls @@ -0,0 +1,97 @@ +{%- set has_debian_repo = salt['pillar.get']('has_debian_repo', False) %} + +{%- if has_debian_repo %} + +{%- set repo_root_dir = salt['pillar.get']('debian_repo:root_dir', '/var/www/html') %} +{%- set debian_sub_dir = salt['pillar.get']('debian_repo:debian_sub_dir', 'Debian') %} +{%- set ubuntu_sub_dir = salt['pillar.get']('debian_repo:ubuntu_sub_dir', 'Ubuntu') %} +{%- set sources_sub_dir = salt['pillar.get']('debian_repo:sources_sub_dir', 'Sources') %} +{%- set debian_distros = salt['pillar.get']('debian_repo:debian_distros', ['jessie']) %} +{%- set ubuntu_distros = salt['pillar.get']('debian_repo:ubuntu_distros', ['xenial']) %} + + +repo_root_dir: + file.directory: + - name: {{ repo_root_dir }} + - user: root + - group: root + - mode: 0755 + - makedirs: True + +repo_user: + user.present: + - name: repo + - fullname: Repository user {{ grains['host'] }} + - shell: /bin/bash + - uid: 1111 + - gid: users + - groups: + - man + - backup + - operator + - src + - staff + - optional_groups: + - mlocate + - sbuild + - createhome: True + +repo_debian_sub_dir: + file.directory: + - name: {{ repo_root_dir }}/{{ debian_sub_dir }} + - user: repo + - group: root + - mode: 0755 + - require: + - file: repo_root_dir + - user: repo_user + +{%- for distro in debian_distros %} + +repo_debian_{{ distro }}_dir: + file.directory: + - name: {{ repo_root_dir }}/{{ debian_sub_dir }}/{{ distro }} + - user: repo + - group: root + - mode: 0755 + - require: + - file: repo_debian_sub_dir + - user: repo_user + +{%- endfor %} + +repo_ubuntu_sub_dir: + file.directory: + - name: {{ repo_root_dir }}/{{ ubuntu_sub_dir }} + - user: repo + - group: root + - mode: 0755 + - require: + - file: repo_root_dir + - user: repo_user + +repo_sources_sub_dir: + file.directory: + - name: {{ repo_root_dir }}/{{ sources_sub_dir }} + - user: repo + - group: root + - mode: 0755 + - require: + - file: repo_root_dir + - user: repo_user + +{%- for distro in ubuntu_distros %} + +repo_ubuntu_{{ distro }}_dir: + file.directory: + - name: {{ repo_root_dir }}/{{ ubuntu_sub_dir }}/{{ distro }} + - user: repo + - group: root + - mode: 0755 + - require: + - file: repo_ubuntu_sub_dir + - user: repo_user + +{%- endfor %} + +{% endif %} -- 2.39.5