Pārlūkot izejas kodu

refactor(states): split client.sls and server.sls in sub-states

tags/v0.7.0
Nicolas Rodriguez pirms 5 gadiem
vecāks
revīzija
566e38df4e
13 mainītis faili ar 171 papildinājumiem un 102 dzēšanām
  1. +0
    -14
      apt-cacher/ng/client.sls
  2. +20
    -0
      apt-cacher/ng/client/config/file.sls
  3. +5
    -0
      apt-cacher/ng/client/config/init.sls
  4. +5
    -0
      apt-cacher/ng/client/init.sls
  5. +0
    -88
      apt-cacher/ng/server.sls
  6. +61
    -0
      apt-cacher/ng/server/config/file.sls
  7. +5
    -0
      apt-cacher/ng/server/config/init.sls
  8. +7
    -0
      apt-cacher/ng/server/init.sls
  9. +5
    -0
      apt-cacher/ng/server/package/init.sls
  10. +10
    -0
      apt-cacher/ng/server/package/install.sls
  11. +5
    -0
      apt-cacher/ng/server/service/init.sls
  12. +33
    -0
      apt-cacher/ng/server/service/running.sls
  13. +15
    -0
      docs/README.rst

+ 0
- 14
apt-cacher/ng/client.sls Parādīt failu

@@ -1,14 +0,0 @@
{% if grains['os_family'] == 'Debian' %}
{% from "apt-cacher/ng/map.jinja" import apt_cacher_ng with context %}
{%- if apt_cacher_ng.server_address %}

{{ apt_cacher_ng.client_config }}:
file:
- managed
- user: root
- group: root
- mode: '644'
- source: salt://apt-cacher/ng/files/client.conf
- template: jinja
{%- endif %}
{% endif %}

+ 20
- 0
apt-cacher/ng/client/config/file.sls Parādīt failu

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/ng/map.jinja" import apt_cacher_ng with context %}

{%- if grains['os_family'] == 'Debian' %}
{%- if apt_cacher_ng.server_address %}

apt-cacher-ng/config/client_config:
file.managed:
- name: {{ apt_cacher_ng.client_config }}
- user: root
- group: root
- mode: '644'
- source: salt://apt-cacher/ng/files/client.conf
- template: jinja
{%- endif %}
{%- endif %}

+ 5
- 0
apt-cacher/ng/client/config/init.sls Parādīt failu

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

include:
- .file

+ 5
- 0
apt-cacher/ng/client/init.sls Parādīt failu

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

include:
- .config

+ 0
- 88
apt-cacher/ng/server.sls Parādīt failu

@@ -1,88 +0,0 @@
{% from "apt-cacher/ng/map.jinja" import apt_cacher_ng with context %}

{%- if 'include' in apt_cacher_ng %}
include:
{%- for include_line in apt_cacher_ng.include %}
- {{ include_line }}
{%- endfor %}
{%- endif %}

apt-cacher-ng-group:
group.present:
- name: {{ apt_cacher_ng.group }}
- require:
- pkg: apt-cacher-ng
- watch_in:
- service: apt-cacher-ng

apt-cacher-ng-user:
user.present:
- name: {{ apt_cacher_ng.user }}
- require:
- group: apt-cacher-ng-group
- watch_in:
- service: apt-cacher-ng

{%- if grains['os_family'] == 'FreeBSD' %}
apt-cacher-ng-sysrc-user:
sysrc.managed:
- name: apt_cacher_ng_user
- value: "{{ apt_cacher_ng.user }}"
- watch_in:
- service: apt-cacher-ng
{%- endif %}

apt-cacher-ng:
pkg.installed:
- name: {{ apt_cacher_ng.pkg }}
service.running:
- name: {{ apt_cacher_ng.service }}
- enable: True
- watch:
- pkg: {{ apt_cacher_ng.pkg }}
- file: {{ apt_cacher_ng.credentials }}
- file: {{ apt_cacher_ng.server_config }}
- file: {{ apt_cacher_ng.server_cache_dir }}
- file: {{ apt_cacher_ng.server_log_dir }}
{%- if 'require' in apt_cacher_ng %}
- require:
{%- for require in apt_cacher_ng.require %}
- {{ require }}
{%- endfor %}
{%- endif %}
{%- if 'require_in' in apt_cacher_ng %}
- require_in:
{%- for require_in in apt_cacher_ng.require_in %}
- {{ require_in }}
{%- endfor %}
{%- endif %}

{{ apt_cacher_ng.server_config }}:
file.managed:
- user: root
- group: {{ apt_cacher_ng.root_group }}
- mode: '644'
- source: salt://apt-cacher/ng/files/server.conf
- template: jinja

{{ apt_cacher_ng.server_cache_dir }}:
file.directory:
- makedirs: True
- user: {{ apt_cacher_ng.user }}
- group: {{ apt_cacher_ng.group }}
- mode: '2755'

{{ apt_cacher_ng.server_log_dir }}:
file.directory:
- makedirs: True
- user: {{ apt_cacher_ng.user }}
- group: {{ apt_cacher_ng.group }}
- mode: '2755'

{{ apt_cacher_ng.credentials }}:
file.managed:
- user: {{ apt_cacher_ng.user }}
- group: {{ apt_cacher_ng.group }}
- mode: '600'
- source: salt://apt-cacher/ng/files/security.conf
- template: jinja

+ 61
- 0
apt-cacher/ng/server/config/file.sls Parādīt failu

@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_package_install = tplroot ~ '.ng.server.package.install' %}
{%- from tplroot ~ "/ng/map.jinja" import apt_cacher_ng with context %}

include:
- {{ sls_package_install }}

apt-cacher-ng/group/create:
group.present:
- name: {{ apt_cacher_ng.group }}

apt-cacher-ng/user/create:
user.present:
- name: {{ apt_cacher_ng.user }}

{%- if grains['os_family'] == 'FreeBSD' %}
apt-cacher-ng/user/sysrc:
sysrc.managed:
- name: apt_cacher_ng_user
- value: "{{ apt_cacher_ng.user }}"
{%- endif %}

apt-cacher-ng/config/server_config:
file.managed:
- name: {{ apt_cacher_ng.server_config }}
- user: root
- group: {{ apt_cacher_ng.root_group }}
- mode: '644'
- source: salt://apt-cacher/ng/files/server.conf
- template: jinja
- require:
- sls: {{ sls_package_install }}

apt-cacher-ng/config/server_cache_dir:
file.directory:
- name: {{ apt_cacher_ng.server_cache_dir }}
- makedirs: true
- user: {{ apt_cacher_ng.user }}
- group: {{ apt_cacher_ng.group }}
- mode: '2755'

apt-cacher-ng/config/server_log_dir:
file.directory:
- name: {{ apt_cacher_ng.server_log_dir }}
- makedirs: true
- user: {{ apt_cacher_ng.user }}
- group: {{ apt_cacher_ng.group }}
- mode: '2755'

apt-cacher-ng/config/credentials:
file.managed:
- name: {{ apt_cacher_ng.credentials }}
- user: {{ apt_cacher_ng.user }}
- group: {{ apt_cacher_ng.group }}
- mode: '600'
- source: salt://apt-cacher/ng/files/security.conf
- template: jinja

+ 5
- 0
apt-cacher/ng/server/config/init.sls Parādīt failu

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

include:
- .file

+ 7
- 0
apt-cacher/ng/server/init.sls Parādīt failu

@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

include:
- .package
- .config
- .service

+ 5
- 0
apt-cacher/ng/server/package/init.sls Parādīt failu

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

include:
- .install

+ 10
- 0
apt-cacher/ng/server/package/install.sls Parādīt failu

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/ng/map.jinja" import apt_cacher_ng with context %}

apt-cacher-ng/package/install:
pkg.installed:
- name: {{ apt_cacher_ng.pkg }}

+ 5
- 0
apt-cacher/ng/server/service/init.sls Parādīt failu

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

include:
- .running

+ 33
- 0
apt-cacher/ng/server/service/running.sls Parādīt failu

@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.ng.server.config.file' %}
{%- from tplroot ~ "/ng/map.jinja" import apt_cacher_ng with context %}

include:
- {{ sls_config_file }}
{%- if 'include' in apt_cacher_ng %}
{%- for include_line in apt_cacher_ng.include %}
- {{ include_line }}
{%- endfor %}
{%- endif %}

apt-cacher-ng/service/running:
service.running:
- name: {{ apt_cacher_ng.service }}
- enable: true
- require:
- sls: {{ sls_config_file }}
{%- if 'require' in apt_cacher_ng %}
{%- for require in apt_cacher_ng.require %}
- {{ require }}
{%- endfor %}
{%- endif %}
{%- if 'require_in' in apt_cacher_ng %}
- require_in:
{%- for require_in in apt_cacher_ng.require_in %}
- {{ require_in }}
{%- endfor %}
{%- endif %}

+ 15
- 0
docs/README.rst Parādīt failu

@@ -63,6 +63,21 @@ Install and configure apt-cacher-ng.

Supports Debian(ish) distributions and FreeBSD.

``apt-cacher.ng.server.package``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Installs the apt-cacher-ng package.

``apt-cacher.ng.server.config``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Installs the apt-cacher-ng config.

``apt-cacher.ng.server.service``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Manages the startup and running state of the apt-cacher-ng service.

``apt-cacher.ng.client``
^^^^^^^^^^^^^^^^^^^^^^^^


Notiek ielāde…
Atcelt
Saglabāt