官术网_书友最值得收藏!

Setting up authentication between the control server and hosts

When connecting Ansible with remote hosts, Ansible's best practices encourage the use of SSH key sharing. SSH keys allow one Linux host to talk to another without asking for a specific password. In this section we are going to briefly look at how to set SSH key sharing up on the control server and n number of target machines.

If SSH key Sharing is not available Ansible also offers the option to ask for a password using the --ask-become-pass command-line argument.

To get started, create a /etc/ansible/hosts (if it doesn't exist) and add one or more remote systems into its contents. Your specific public SSH key should be located in authorized_keys on those target systems.

In this brief tutorial we will assume the SSH key authentication solution is being used. It helps us avoid having to enter or store raw passwords:

$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa

Now ping all the nodes (assumes you have an inventory file created):

$ ansible all -m ping

For a complete documentation set around setting up SSH key sharing in Ubuntu the documentation can be found at http://linuxproblem.org/art_9.html.

主站蜘蛛池模板: 华阴市| 冀州市| 岑巩县| 湘潭县| 伊春市| 长沙县| 乌拉特中旗| 威远县| 莱芜市| 漳浦县| 玉山县| 分宜县| 印江| 通化县| 崇信县| 利川市| 通化市| 乐昌市| 锦州市| 荆门市| 南澳县| 甘肃省| 莱西市| 革吉县| 乐安县| 昌吉市| 抚顺市| 苍山县| 金川县| 枣强县| 平遥县| 兰西县| 长葛市| 安岳县| 尖扎县| 友谊县| 象山县| 滨州市| 万荣县| 新乐市| 辽阳县|