https://docs.saltstack.com/en/getstarted/system/plugins.htmlhtml
包-變成命令python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
apache:
#yum 安裝
pkg.installed: []
service.running:
#apache必須運行
-
reload
:
True
-
watch:
-
file
:
/
etc
/
httpd
/
conf
/
httpd.conf
#若是配置文件有變動就重啓
user.present:
-
uid:
87
#- username: alex
-
gid:
87
-
home:
/
var
/
www
/
html
-
shell:
/
bin
/
nologin
-
require:
-
group: apache
group.present:
#apache組不存在上面的命令不執行
-
gid:
87
-
require:
-
pkg: apache
/
etc
/
httpd
/
conf
/
httpd.conf:
#每執行一次配置文件就更新一次
file
.managed:
-
source: salt:
/
/
apache
/
httpd.conf
-
user: root
-
group: root
-
mode:
644
|
from django.db import models # Create your models here. class Host(models.Model): ''' salt裏面根本用不上ip,他是使用id或者grup組ID和hostname區別主機的惟一性的 saltsack服務器端和客戶端是如何認證的 ? 客戶端和服務器端的認證是經過key來進行認證,客戶端主動找服務器驗證, 我想被你管理,服務器有一個待審批想被管理的列表,贊成後就能夠管理了 ''' hostname = models.CharField(max_length=128,unique=True) key = models.TextField() status_choices = ((0,'Waiting Approval'), (1,'Accepted'), (2,'Rejected')) '''每一個主機的三個狀態等待、容許、拒絕''' def __str__(self): return self.hostname class HostGroup(models.Model): name = models.CharField(max_length=64,unique=True) hosts = models.ManyToManyField(Host,blank=True) def __str__(self): return self.name