首页 > 其他 > 详细

ansible批量修改sshd_config

时间:2017-09-19 10:59:20      阅读:603      评论:0      收藏:0      [点我收藏+]
---
- hosts: all
  gather_facts: true
  remote_user: root
  tasks:
  - name: "修改ssh配置文件的安全选项"
    lineinfile:
      path: /etc/ssh/sshd_config
      regexp: ‘{{ item.regexp }}‘
      line: ‘{{ item.line }}‘
      state: present
    with_items:
      - regexp: "^PasswordAuthentication"
        line: "PasswordAuthentication no"
      - regexp: "^#PermitRootLogin yes"
        line: "PermitRootLogin no"
      - regexp: "^#Port 22"
        line: "Port 2249"
      - regexp: "^GSSAPIAuthentication yes"
        line: "GSSAPIAuthentication no"
    notify:
      - restart sshd
  handlers:
    - name: restart sshd
      service:
        name: sshd
        state: restarted


本文出自 “激情燃烧的岁月” 博客,请务必保留此出处http://liuzhengwei521.blog.51cto.com/4855442/1966503

ansible批量修改sshd_config

原文:http://liuzhengwei521.blog.51cto.com/4855442/1966503

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!