zoukankan      html  css  js  c++  java
  • 3.ansible-iventory的写法和基本变量

    ansible的配置文件一点要多考虑,有些设定比如ssh端口啊用户啊线程啊都尽量在里面调节好
    iventory的话/etc/ansible/hosts 里面可以使用正则匹配
    ansible从inventory开始就从inventory开始给你们讲起来
    1.hosts文件的基本构成是hosts hosts可以构成组也就是group,group可以构成大组
    --------------------------------------------------------------------------------
    [atlanta]
    host1
    host2
    [raleigh]
    host2
    host3
    [southeast:children]
    atlanta
    raleigh
    --------------------------------------------------------------------------------
    2.hosts可以有自己的变量group可以设定公用的变量
    --------------------------------------------------------------------------------
    [atlanta]
    host1 http_port=80 maxRequestsPerChild=808
    host2 http_port=303 maxRequestsPerChild=909
    [atlanta]
    host1
    host2
    [atlanta:vars]
    ntp_server=ntp.atlanta.example.com
    proxy=proxy.atlanta.example.com
    --------------------------------------------------------------------------------
    3.书写方式有两种列表和yml
    4.inventory支持匹配
    --------------------------------------------------------------------------------
    [webservers]
    www[01:50].example.com
    [databases]
    db-[a:f].example.com
    --------------------------------------------------------------------------------
    5.默认有一个all组包含所有的hosts
    6.还可以以文件的形势记录我们的变量
    --------------------------------------------------------------------------------
    /etc/ansible/group_vars/raleigh # can optionally end in '.yml', '.yaml', or '.json'
    /etc/ansible/group_vars/webservers
    /etc/ansible/host_vars/foosball
    --------------------------------------------------------------------------------
    ---
    ntp_server: acme.example.org
    database_server: storage.example.org
    --------------------------------------------------------------------------------
    7.常见的变量
    --------------------------------------------------------------------------------
    ansible_host
    ansible_port
    ansible_user
    ansible_ssh_pass 通常不使用明文,使用vault(老子不会啊)
    ansible_ssh_private_key_file
    ansible_ssh_executable
    This setting overrides the default behavior to use the system ssh. This can override the ssh_executable setting in ansible.cfg.

    ansible_become
    ansible_become_method
    ansible_become_user
    ansible_become_pass
    ansible_shell_type
    --------------------------------------------------------------------------------
    8.ansible可以和cobbler这也得批量装机工具管理动态inventory很复杂,在云上环境用的也不多。

  • 相关阅读:
    跟我学SharePoint 2013视频培训课程——什么是SharePoint 2013(1)
    SharePoint 关于拓扑错误的解决方案
    SharePoint 2010、2013多个域之间互信(Domain Trust)的设计与实施
    SharePoint 2013 Disaster Recovery——迁移内容数据库
    windows-根据进程PID 获取进程路径
    kernel 获取ntoskrnl.exe基址
    ring3 x32挂起进程注入原理.
    CryEntryBuffer
    windows内核代码之进程操作
    驱动中遍历模块,以及获取ntoskrnl.exe基址
  • 原文地址:https://www.cnblogs.com/leleyao/p/8994663.html
Copyright © 2011-2022 走看看