zoukankan      html  css  js  c++  java
  • Ansible的配置文件:

    Ansible的配置文件:
    
    Ansible 的一些的设置可以通过配置文件完成,在大多数场景下默认的配置就能满足大多数用户的需求,
    
    在一些特殊场景下,用户还是需要自行修改这些配置文件。
    
    
    用户可以修改一下配置文件来修改设置,它们被读取的顺序如下:
    
    * ANSIBLE_CONFIG (一个环境变量)
    * ansible.cfg (位于当前目录中)
    * .ansible.cfg (位于家目录中)
    * /etc/ansible/ansible.cfg
    
    
    环境配置:
    
    Ansible通过环境变量的形式来进行配置,这些设置后的环境变量将会覆盖
    
    所有配置文件读取的配置。
    
    [root@node01 ansible]# cat ansible.cfg 
    [defaults]
    inventory      = /etc/ansible/hosts
    sudo_user=root
    remote_port=22
    host_key_checking=False
    remote_user=root
    log_path=/var/log/ansible.log
    module_name=command
    private_key_file=/root/.ssh/id_rsa
    no_log:True
    [root@node01 ansible]# 
    [root@node01 ansible]# ansible webservers -m raw -a "hostname"              
    [DEPRECATION WARNING]: DEFAULT_SUDO_USER option, In favor of become which is a generic framework . This feature will be 
    removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
    192.168.137.3 | SUCCESS | rc=0 >>
    node2
    Shared connection to 192.168.137.3 closed.
    
    115.236.19.4 | SUCCESS | rc=0 >>
    yun-bak
    Shared connection to 115.236.19.4 closed.
    
    192.168.137.1 | SUCCESS | rc=0 >>
    TLCB-PC
    Shared connection to 192.168.137.1 closed.
    
    ansible_managed:
    
    ask_pass
    这个可以控制,Ansible 剧本playbook 是否会自动默认弹出弹出密码.默认为no::
    ask_pass=True
    如果使用SSH 密钥匙做身份认证.可能需要修改这一参数
    
    [root@node01 ansible]# ansible webservers -m raw -a "hostname"
    [DEPRECATION WARNING]: DEFAULT_SUDO_USER option, In favor of become which is a generic framework . This feature will be 
    removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
    SSH password: 
    

  • 相关阅读:
    滑动拼图
    CentOS8安装中文输入法
    windows+ubuntu 双系统时间不一致的问题
    Goland 2019下载和安装(带破解补丁和汉化包)
    防火墙站名资源脚本
    linux上以服务方式启动程序kestrel
    NLog实践记录
    sqlserver安装ubuntu
    pyspark提交集群任务
    无法打开hadoop的UI页面
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349479.html
Copyright © 2011-2022 走看看