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