目前这边没有使用认证系统(网络认证系统会在新书中有所介绍),所以用户登录都是使用SSH的Key,服务器比较多的时候一台台的去加不太合适,所以现在搞了S的模块来对服务器统一的配置。
还是和往常一样,主要的东西放在install.sls里,然后一个init.sls把install.sls文件include进来即可。
install.sls文件内容为
/home/liuxin/.ssh/authorized_keys:
file.managed:
- source: salt://users/authorized_keys
- makedirs: True
- user: liuxin
- group: liuxin
- mode: 0700
- require:
- user: liuxin
liuxin:
user.present:
- uid: 1982
- gid: 1982
{% if grains['os_family'] == 'Debian' %}
- groups:
- sudo
{% elif grains['os_family'] == 'RedHat' %}
- groups:
- wheel
{% endif %}
- home: /home/liuxin
- shell: /bin/bash
- require:
- group: liuxin
group.present:
- gid: 1982
阅读(4551) | 评论(0) | 转发(0) |