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

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.

主站蜘蛛池模板: 通辽市| 镇雄县| 克东县| 韶山市| 眉山市| 阿拉善右旗| 上虞市| 睢宁县| 广州市| 通州区| 东安县| 岫岩| 南安市| 温宿县| 延寿县| 武鸣县| 肃宁县| 平阴县| 黔西| 杨浦区| 札达县| 达拉特旗| 五华县| 香格里拉县| 临漳县| 灌南县| 巴林左旗| 建昌县| 襄垣县| 苏尼特右旗| 宽甸| 河源市| 武穴市| 五莲县| 广宗县| 巩义市| 湘乡市| 诸城市| 武汉市| 黑龙江省| 洱源县|