Skip to content

Commit

Permalink
feat(init): top level meta state apply states based on configuration
Browse files Browse the repository at this point in the history
Minion should only have the proper configuration set and running
`state.apply moosefs` will apply only enabled components.

BREAKING CHANGE: you must set `master:enabled`, `metalogger:enabled`,
  `chunkserver:enabled`, `cgiserv:enabled`, `client:enabled`,
  `cli:enabled` and `netdump:enabled` to install each component with
  the top level state
  • Loading branch information
baby-gnu committed Feb 13, 2023
1 parent 46e261f commit 71aa2f3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 19 deletions.
20 changes: 20 additions & 0 deletions moosefs/cleaned.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- mode: salt; coding: utf-8 -*-
# vim: ft=sls

{%- set includes = [] %}
{%- set components = [
"netdump",
"cli",
"client",
"cgiserv",
"cgi",
"chunkserver",
"metalogger",
"master",
] %}

{%- for component in components %}
{%- do includes.append("." ~ component ~ ".cleaned") %}
{%- endfor %}

include: {{ includes }}
41 changes: 22 additions & 19 deletions moosefs/init.sls
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{% from "moosefs/map.jinja" import moosefs with context %}
# -*- mode: salt; coding: utf-8 -*-
# vim: ft=sls

{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split("/")[0] %}
{%- from tplroot ~ "/libs/map.jinja" import mapdata as moosefs without context %}
build_essestial:
pkg.installed:
- pkgs:
{% for required_pkg in moosefs.required_pkgs %}
- {{ required_pkg }}
{% endfor %}
{%- set includes = [] %}
{%- set components = [
"master",
"metalogger",
"chunkserver",
"cgi",
"cgiserv",
"client",
"cli",
"netdump",
] %}
mfs-group:
group.present:
- name: mfs
- system: True
{%- for component in components %}
{%- if moosefs | traverse(component ~ ":enabled", False) %}
{%- do includes.append("." ~ component) %}
{%- endif %}
{%- endfor %}
mfs:
user.present:
- name: mfs
- fullname: MooseFS
- home: /home/mfs
- createhome: True
- groups:
- mfs
include: {{ includes }}

0 comments on commit 71aa2f3

Please sign in to comment.