# SaltStack

### 官方文档

{% embed url="<https://docs.saltproject.io/en/latest/contents.html>" %}

### 项目地址

{% embed url="<https://github.com/saltstack/salt>" %}

### 快速开始

1、配置安装源

```
rpm --import https://repo.saltproject.io/py3/redhat/7/x86_64/latest/SALTSTACK-GPG-KEY.pub
curl -fsSL https://repo.saltproject.io/py3/redhat/7/x86_64/latest.repo | sudo tee /etc/yum.repos.d/salt.repo
```

2、安装 salt-master

```
yum install salt-master -y
```

3、启动 salt-master 并配置开机自启动

```
systemctl start salt-master
systemctl enable salt-master
```

4、安装 salt-minion

```
yum install salt-minion -y
```

5、配置 salt-minion

{% code title="/etc/salt/minion" %}

```
# master 设置 salt-master 节点地址
master: salt-master
# id 设置当前 salt-minion 节点的标识 id
id: salt-minion01
```

{% endcode %}

6、启动 salt-minion 并设置开机自启动

```
systemctl start salt-minion
systemctl enable salt-minion
```

7、在 salt-master 节点上查看等待连接的 salt-minion 密钥，并允许连接

```
salt-key -L
salt-key -a salt-minion01 -y
```

{% hint style="info" %}
可使用 -d 参数替换 -a 参数移除 salt-minion 密钥
{% endhint %}

8、 测试连接

```
salt "*" test.ping
```

### 参考资料

{% embed url="<https://www.cnblogs.com/yanjieli/p/10864648.html?page=4>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viva.gitbook.io/project/kai-fa/saltstack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
