zoukankan      html  css  js  c++  java
  • ssh首次链接出现yes/no提示和ansible提示

    修改文件: /etc/ssh/ssh_config 

    在文件中添加如下信息:StrictHostKeyChecking no

    改本机的/etc/ssh/ssh_config文件中的"# StrictHostKeyChecking ask" 为 "StrictHostKeyChecking no",

     

     

    如何去除ssh无交互式添加 known_hosts

     

    配置文件/etc/ansible/ansible.cfg的[defaults]中

     

    打开注释

     

    # uncomment this to disable SSH key host checking

     

    host_key_checking = False

    ansible自动下发ssh密钥:

    https://docs.ansible.com/ansible/latest/modules/authorized_key_module.html

    - name: Set authorized key taken from file
      authorized_key:
        user: charlie
        state: present
        key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
    
    - name: Set authorized keys taken from url
      authorized_key:
        user: charlie
        state: present
        key: https://github.com/charlie.keys
    
    - name: Set authorized key in alternate location
      authorized_key:
        user: charlie
        state: present
        key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
        path: /etc/ssh/authorized_keys/charlie
        manage_dir: False
    
    - name: Set up multiple authorized keys
      authorized_key:
        user: deploy
        state: present
        key: '{{ item }}'
      with_file:
        - public_keys/doe-jane
        - public_keys/doe-john
    
    - name: Set authorized key defining key options
      authorized_key:
        user: charlie
        state: present
        key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
        key_options: 'no-port-forwarding,from="10.0.1.1"'
    
    - name: Set authorized key without validating the TLS/SSL certificates
      authorized_key:
        user: charlie
        state: present
        key: https://github.com/user.keys
        validate_certs: False
    
    - name: Set authorized key, removing all the authorized keys already set
      authorized_key:
        user: root
        key: '{{ item }}'
        state: present
        exclusive: True
      with_file:
        - public_keys/doe-jane
    
    - name: Set authorized key for user ubuntu copying it from current user
      authorized_key:
        user: ubuntu
        state: present
        key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"

     

  • 相关阅读:
    详解Redis中两种持久化机制RDB和AOF(面试常问,工作常用)
    IDEA链接数据库自动生成实体类
    urllib的高级用法
    django项目部署上线
    Git 远程仓库(Github)
    git 标签
    git分支管理
    Git 工作区、暂存区和版本库
    git介绍及安装
    Python3-笔记-numpy学习指南-002-基础
  • 原文地址:https://www.cnblogs.com/smlie/p/10994755.html
Copyright © 2011-2022 走看看