Merge branch 'master' into macos

This commit is contained in:
N authored and GitHub committed 2020-06-01 01:15:32 +01:00
commit 3920ed3bd4
40 files changed
+1284 -242

No files matched your search

+4 -2
View File
@@ -11,8 +11,9 @@ salt-api:
- version: {{ salt_settings.version }}
{%- endif %}
{% endif %}
service.running:
- enable: True
{% if salt_settings.api_service_details.state != 'ignore' %}
service.{{ salt_settings.api_service_details.state }}:
- enable: {{ salt_settings.api_service_details.enabled }}
- name: {{ salt_settings.api_service }}
- require:
- service: {{ salt_settings.master_service }}
@@ -21,3 +22,4 @@ salt-api:
- pkg: salt-api
{% endif %}
- file: salt-master
{% endif %}
+22
View File
@@ -3,6 +3,7 @@
---
salt:
version: ''
pin_version: false
py_ver: '' ## py2 is default
rootuser: root
rootgroup: root
@@ -19,8 +20,23 @@ salt:
master_config_use_TOFS: false
minion_service: salt-minion
minion_service_details:
# special name 'ignore' will not output anything about the service
state: running
enabled: true
master_service: salt-master
master_service_details:
# special name 'ignore' will not output anything about the service
state: running
enabled: true
api_service: salt-api
api_service_details:
# special name 'ignore' will not output anything about the service
state: running
enabled: true
syndic_service: salt-syndic
salt_master: salt-master
@@ -32,11 +48,16 @@ salt:
salt_api: salt-api
salt_ssh: salt-ssh
pkgrepo: '' # see osfamilymap
ssh_roster: {} # see pillar data
python_git: python-git
python_dulwich: python-dulwich
master:
gitfs_provider: gitpython
minion:
master_type: true # see init.sls & standalone.sls
gitfs:
dulwich:
@@ -64,6 +85,7 @@ salt:
maps: salt://salt/files/cloud.maps.d
salt_formulas:
list: {} # via pillar data
checkout_orig_branch: false
git_opts:
default:
+2 -2
View File
@@ -34,7 +34,7 @@
{%- do processed_basedirs.append(basedir) %}
{{ basedir }}:
file.directory:
- parallel: {{ salt.pkg.version_cmp(grains['saltversion'], '2017.7.0') >= 0 }}
- parallel: {{ grains['saltversioninfo'] >= [2017, 7, 0] }}
{%- for key, value in salt['pillar.get']('salt_formulas:basedir_opts',
{'makedirs': True}).items() %}
- {{ key }}: {{ value }}
@@ -54,7 +54,7 @@
{{ gitdir_env }}:
git.latest:
- name: {{ baseurl }}/{{ f_name }}.git
- parallel: {{ salt.pkg.version_cmp(grains['saltversion'], '2017.7.0') >= 0 }}
- parallel: {{ grains['saltversioninfo'] >= [2017, 7, 0] }}
- target: {{ gitdir }}
{%- for key, value in options.items() %}
- {{ key }}: {{ value }}
Executable
+30
View File
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
include:
- salt.pkgrepo
{%- if salt.config.get('salt_formulas:list') %}
- salt.formulas
{%- endif %}
{%- if salt.config.get('salt:master')|length > 1 %}
- salt.master
{%- endif %}
{%- if salt.config.get('salt:cloud')|length > 1 %}
- salt.cloud
{%- endif %}
{%- if salt.config.get('salt:ssh_roster') %}
- salt.ssh
{%- endif %}
{%- if salt.config.get('salt:minion')|length > 1 %}
{%- if salt.config.get('salt:minion:master_type') %}
- salt.minion
{%- else %}
- salt.standalone
{%- endif %}
{%- endif %}
{%- if salt.config.get('salt:api') %}
- salt.api
{%- endif %}
{%- if salt.config.get('salt:syndic') %}
- salt.syndic
{%- endif %}
+13 -5
View File
@@ -2,7 +2,7 @@
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- if grains.os == 'MacOS' %}
{%- if grains.os == 'MacOS' %}
salt-master-macos:
file.managed:
- name: /Library/LaunchDaemons/com.saltstack.salt.master.plist
@@ -21,7 +21,12 @@ salt-master-macos:
- file: salt-master-macos
- require_in:
- service: salt-master
{%- endif %}
{%- endif %}
{% if salt_settings.pin_version and salt_settings.version and grains.os_family|lower == 'debian' %}
include:
- .pin
{% endif %}
salt-master:
{% if salt_settings.install_packages %}
@@ -30,10 +35,12 @@ salt-master:
{%- if salt_settings.version is defined %}
- version: {{ salt_settings.version }}
{%- endif %}
{% if salt_settings.master_service_details.state != 'ignore' %}
- require_in:
- service: salt-master
- watch_in:
- service: salt-master
{% endif %}
{% endif %}
file.recurse:
- name: {{ salt_settings.config_path }}/master.d
@@ -49,13 +56,14 @@ salt-master:
{%- endif %}
- clean: {{ salt_settings.clean_config_d_dir }}
- exclude_pat: _*
service.running:
- enable: True
{% if salt_settings.master_service_details.state != 'ignore' %}
service.{{ salt_settings.master_service_details.state }}:
- enable: {{ salt_settings.master_service_details.enabled }}
- name: {{ salt_settings.master_service }}
- watch:
- file: salt-master
- file: remove-old-master-conf-file
{% endif %}
{% if salt_settings.master_remove_config %}
remove-default-master-conf-file:
file.absent:
+16 -4
View File
@@ -2,8 +2,14 @@
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- if grains.os == 'MacOS' %}
{% if salt_settings.install_packages %}
{% if salt_settings.pin_version and salt_settings.version and grains.os_family|lower == 'debian' %}
include:
- .pin
{% endif %}
{%- if grains.os == 'MacOS' %}
{% if salt_settings.install_packages %}
download-salt-minion:
{% if salt_settings.salt_minion_pkg_source %}
{# only IF we know source and version to check the current install (if installed) against #}
@@ -68,8 +74,10 @@ salt-minion:
- force: True
- unless:
- test -n "{{ salt_settings.version }}" && '/opt/salt/bin/salt-minion --version=.*{{ salt_settings.version }}.*'
{% if salt_settings.minion_service_details.state != 'ignore' %}
- require_in:
- service: salt-minion
{% endif %}
- onchanges_in:
- cmd: remove-macpackage-salt
{%- elif grains.os != 'MacOS' and "workaround https://github.com/saltstack/salt/issues/49348" %}
@@ -78,8 +86,10 @@ salt-minion:
{%- if salt_settings.version %}
- version: {{ salt_settings.version }}
{%- endif %}
{% if salt_settings.minion_service_details.state != 'ignore' %}
- require_in:
- service: salt-minion
{% endif %}
{%- endif %}
{% endif %}
file.recurse:
@@ -98,11 +108,13 @@ salt-minion:
{%- endif %}
- clean: {{ salt_settings.clean_config_d_dir }}
- exclude_pat: _*
service.running:
- enable: True
{% if salt_settings.minion_service_details.state != 'ignore' %}
service.{{ salt_settings.minion_service_details.state }}:
- enable: {{ salt_settings.minion_service_details.enabled }}
- name: {{ salt_settings.minion_service }}
- require:
- file: salt-minion
{% endif %}
{%- if not salt_settings.restart_via_at %}
cmd.run:
{%- if grains['saltversioninfo'] >= [ 2016, 3 ] %}
+4 -7
View File
@@ -4,11 +4,7 @@
{%- set py_ver_repr = salt['pillar.get']('salt:py_ver', '') %}
{%- set osrelease = salt['grains.get']('osrelease') %}
{#- Workaround for OpenSuse Leap 15.1 until the repo is available #}
{%- if [grains.os_family, osrelease] == ['Suse', '15.1'] %}
{%- set osrelease = '15.0' %}
{%- endif %}
{%- set osrelease = salt['grains.get']('osrelease', '') %}
{%- set salt_release = salt['pillar.get']('salt:release', 'latest') %}
{%- if salt_release.split('.')|length >= 3 %}
{%- set salt_release = 'archive/' ~ salt_release %}
@@ -16,6 +12,7 @@
{%- set osfamily_lower = salt['grains.get']('os_family')|lower %}
{%- set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %}
{%- set oscodename = salt['grains.get']('oscodename') %}
{%- set suse_testing_repo = ':/products:/next:/testing' if [osfamily_lower, osrelease] == ['suse', '15.2'] else '' %}
#from template-formula
{%- if grains.os == 'MacOS' %}
@@ -58,8 +55,8 @@ RedHat:
Suse:
pkgrepo_humanname: 'Salt releases for SLE-based SUSE products (openSUSE_Leap_{{ osrelease }})'
pkgrepo: 'http://repo.saltstack.com/opensuse/openSUSE_Leap_{{ osrelease }}/'
key_url: 'http://repo.saltstack.com/opensuse/openSUSE_Leap_{{ osrelease }}/repodata/repomd.xml.key'
pkgrepo: 'https://download.opensuse.org/repositories/systemsmanagement:/saltstack{{ suse_testing_repo }}/openSUSE_Leap_{{ osrelease }}/'
key_url: 'https://download.opensuse.org/repositories/systemsmanagement:/saltstack{{ suse_testing_repo }}/openSUSE_Leap_{{ osrelease }}/repodata/repomd.xml.key'
pygit2: python-pygit2
pyinotify: python-pyinotify
gitfs:
+22
View File
@@ -0,0 +1,22 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
{% if salt_settings.pin_version and salt_settings.version and grains.os_family|lower == 'debian' %}
salt-pin-version:
file.managed:
- name: /etc/apt/preferences.d/salt
- contents: |
# This file managed by Salt, do not edit by hand!!
Package: salt*
Pin: version {{ salt_settings.version }}
Pin-Priority: 1000
# Order: 2 because we can't put a require_in on "pkg: salt-{master,minion}"
# because we don't know if they are used, and 'order: 1' already occupied by salt-pkgrepo
- order: 2
{% elif grains.os_family|lower != 'debian' %}
salt-pin-version:
test.show_notification:
- name: Available on Debian family OS-es only
- text: Apt pinning available only on Debian based distributives
{% endif %}
+8
View File
@@ -1,2 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{% from "salt/map.jinja" import salt_settings with context %}
{%- if salt_settings.pkgrepo %}
include:
- .{{ grains['os_family']|lower }}
{%- endif %}
+12 -12
View File
@@ -1,14 +1,14 @@
{%- set tplroot = tpldir.split('/')[0] %}
{% from "salt/map.jinja" import salt_settings with context %}
salt-minion:
{% if salt_settings.install_packages %}
salt-minion-standalone:
{% if salt_settings.install_packages %}
pkg.installed:
- name: {{ salt_settings.salt_minion }}
{%- if salt_settings.version is defined %}
{%- if salt_settings.version is defined %}
- version: {{ salt_settings.version }}
{%- endif %}
{% endif %}
{%- endif %}
{% endif %}
file.recurse:
- name: {{ salt_settings.config_path }}/minion.d
- template: jinja
@@ -17,19 +17,19 @@ salt-minion:
- exclude_pat: _*
- context:
standalone: True
{%- if salt_settings.minion.master_type is defined and salt_settings.minion.master_type == 'disable' %}
{%- if not salt_settings.minion.master_type %}
service.running:
- enable: True
{%- else %}
{%- else %}
service.dead:
- enable: False
{%- endif %}
{%- endif %}
- name: {{ salt_settings.minion_service }}
- require:
{% if salt_settings.install_packages %}
- pkg: salt-minion
{% endif %}
- file: salt-minion
{% if salt_settings.install_packages %}
- pkg: salt-minion-standalone
{% endif %}
- file: salt-minion-standalone
# clean up old _defaults.conf file if they have it around
remove-old-standalone-conf-file: