ansible hosts配置,ansiblehosts

來源:互聯網
上載者:User

ansible hosts配置,ansiblehosts
Inventory 分組    Ansible可同時操作屬於一個組的多台主機,組和主機之間的關係通過inventory檔案配置,預設檔案路徑為/etc/ansible/hosts 常用參數配置:    ansible_ssh_host                    # 目標主機地址    ansible_ssh_port                    # 目標主機連接埠,預設22    ansible_ssh_user                    # 目標主機使用者    ansible_ssh_pass                    # 目標主機ssh密碼    ansible_sudo_pass                 # sudo密碼    ansible_sudo_exe                        ansible_connection               # 與主機的連線類型,比如:local,ssh或者paramiko    ansible_ssh_private_key_file  # 私密金鑰地址    ansible_shell_type                 # 目標系統的shell類型    ansible_python_interpreter   # python版本 格式:[組名]     例如 :       [test]     # 組名        10.0.0.1  # 主機ip  或者10.0.0.1:65522 自訂連接埠別名    s1 ansible_ssh_port=65522 ansible_ssh_host=10.0.0.1 ansible_ssh_user=simon    # 別名s1 連續的主機  [g1]         g[1:50].example.com          g[a-f].example.com 

[all:vars]         # *:vars 塊變數,all:vars 全域變數ansible_ssh_private_key_file=/root/.ssh/id_rsaansible_ssh_port=22ansible_ssh_user=root[t3:vars]  # t3 使用python解譯器是python2ansible_python_interpreter=/usr/bin/python2nginx_port=80               # 私人變數在playbooks中使用[t3]192.168.11.162

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.