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

  • Mastering Ceph
  • Nick Fisk
  • 246字
  • 2021-07-09 19:55:14

Creating your inventoryfile

The Ansible inventory file is used by Ansible to reference all known hosts and to which group they belong. A group is defined by placing its name in square brackets, groups can be nested inside other groups by the use of the children definition.

Before we add hosts to the inventory file, we first need to configure the remote nodes for SSH (without password); otherwise, we will have to enter a password every time Ansible tries to connect to a remote machine.

Generate an SSH key as follows:

    $ ssh-keygen 

The preceding command gives the following output:

Copy the key to the remote hosts:

    $ ssh-copy-id mon1

The preceding command gives the following output:

This will need to be repeated for each host. Normally, you would include this step in your Vagrant provisioning stage, but it is useful to carry out these tasks manually the first couple of times so that an understanding of the process is learned.

Now try logging into the machine using ssh mon1:

Type exit to return to the Ansible VM.

Now, let's create the Ansible inventory file.

Edit the file named hosts in /etc/ansible:

    $ sudo nano /etc/ansible/hosts

Create two groups named osds and mons and finally a third group named ceph. This third group will contain the osds and mons groups as children.

Enter a list of your hosts under the correct group, as follows:

[mons] 
mon1
mon2
mon3

[osds]
osd1
osd2
osd3

[ceph:children]
mons
osds
主站蜘蛛池模板: 白沙| 沙田区| 来安县| 大渡口区| 东乡县| 甘洛县| 平定县| 蓝山县| 观塘区| 深水埗区| 天气| 西华县| 丹凤县| 大荔县| 玉龙| 阿拉尔市| 财经| 绿春县| 凤台县| 政和县| 贵港市| 扶沟县| 平和县| 京山县| 临沭县| 双鸭山市| 苏尼特右旗| 横峰县| 宿迁市| 达日县| 博罗县| 兴宁市| 鄂托克前旗| 武宁县| 玛纳斯县| 祁阳县| 杭锦旗| 台江县| 涟源市| 垣曲县| 祁东县|