0-2-openstack(rocky)安装准备-jumper部署ansible

jumper上面部署ansible,分发密钥

[[email protected] ansible]
# ssh-keygen -t rsa -b 2048 -N ”
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:MpS2Pg4UkSGxbKdmd8Q9APCgLuq+b4BpHo3zoCkIJEY [email protected]
The key’s randomart image is:
+—[RSA 2048]—-+
| =o++. |
| E =.o + |
|o + + * o |
|o+ o = . . |
|o o = S |
|X + o o | |B. . o |
|*. o o . |
|o++. . |
+—-[SHA256]—–+

[[email protected] ansible]
# ansible all -m authorized_key -a “user=root exclusive=true manage_dir=true key=’$(< /root/.ssh/id_rsa.pub)'" -k SSH password: compute3 | CHANGED => {
“changed”: true,
“comment”: null,
“exclusive”: true,
“follow”: false,
“key”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGWq7V5gP6Wndq7ZJLXegs1j0djV+kfixuMST2AXaoRTUPvKazUdVTE3ulq/Tk443Vq96fUi+tnc9o95hOZmTYxfYlKucKgOk/AmFq/9oRHd2UFtZurVwIR0olD6A5NuXO4ksKvYjIqMM1dXmFJ2iG5+ODgm+y1u40oFj2Pz7HRft/mp1W06s4K3SF/L3RT8hVFCU0HGaRqsvx0D8TYDGluvbMKE6we235cOct5Od495Hgv+hJuPIsWpm4o6tU7+rLp9oTGl+xP2JKGpYNdZQX+XgqSRJ8ie3ccaAM3K0uEGbRTagB3bouGDWiP21CPH5pWvl94I7mnxr3wv8si+0l [email protected]”,
“key_options”: null,
“keyfile”: “/root/.ssh/authorized_keys”,
“manage_dir”: true,
“path”: null,
“state”: “present”,
“unique”: false,
“user”: “root”,
“validate_certs”: true
}
compute5 | CHANGED => {
“changed”: true,
“comment”: null,
“exclusive”: true,
“follow”: false,
“key”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGWq7V5gP6Wndq7ZJLXegs1j0djV+kfixuMST2AXaoRTUPvKazUdVTE3ulq/Tk443Vq96fUi+tnc9o95hOZmTYxfYlKucKgOk/AmFq/9oRHd2UFtZurVwIR0olD6A5NuXO4ksKvYjIqMM1dXmFJ2iG5+ODgm+y1u40oFj2Pz7HRft/mp1W06s4K3SF/L3RT8hVFCU0HGaRqsvx0D8TYDGluvbMKE6we235cOct5Od495Hgv+hJuPIsWpm4o6tU7+rLp9oTGl+xP2JKGpYNdZQX+XgqSRJ8ie3ccaAM3K0uEGbRTagB3bouGDWiP21CPH5pWvl94I7mnxr3wv8si+0l [email protected]”,
“key_options”: null,
“keyfile”: “/root/.ssh/authorized_keys”,
“manage_dir”: true,
“path”: null,
“state”: “present”,
“unique”: false,
“user”: “root”,
“validate_certs”: true
}
compute1 | CHANGED => {
“changed”: true,
“comment”: null,
“exclusive”: true,
“follow”: false,
“key”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGWq7V5gP6Wndq7ZJLXegs1j0djV+kfixuMST2AXaoRTUPvKazUdVTE3ulq/Tk443Vq96fUi+tnc9o95hOZmTYxfYlKucKgOk/AmFq/9oRHd2UFtZurVwIR0olD6A5NuXO4ksKvYjIqMM1dXmFJ2iG5+ODgm+y1u40oFj2Pz7HRft/mp1W06s4K3SF/L3RT8hVFCU0HGaRqsvx0D8TYDGluvbMKE6we235cOct5Od495Hgv+hJuPIsWpm4o6tU7+rLp9oTGl+xP2JKGpYNdZQX+XgqSRJ8ie3ccaAM3K0uEGbRTagB3bouGDWiP21CPH5pWvl94I7mnxr3wv8si+0l [email protected]”,
“key_options”: null,
“keyfile”: “/root/.ssh/authorized_keys”,
“manage_dir”: true,
“path”: null,
“state”: “present”,
“unique”: false,
“user”: “root”,
“validate_certs”: true
}
compute2 | CHANGED => {
“changed”: true,
“comment”: null,
“exclusive”: true,
“follow”: false,
“key”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGWq7V5gP6Wndq7ZJLXegs1j0djV+kfixuMST2AXaoRTUPvKazUdVTE3ulq/Tk443Vq96fUi+tnc9o95hOZmTYxfYlKucKgOk/AmFq/9oRHd2UFtZurVwIR0olD6A5NuXO4ksKvYjIqMM1dXmFJ2iG5+ODgm+y1u40oFj2Pz7HRft/mp1W06s4K3SF/L3RT8hVFCU0HGaRqsvx0D8TYDGluvbMKE6we235cOct5Od495Hgv+hJuPIsWpm4o6tU7+rLp9oTGl+xP2JKGpYNdZQX+XgqSRJ8ie3ccaAM3K0uEGbRTagB3bouGDWiP21CPH5pWvl94I7mnxr3wv8si+0l [email protected]”,
“key_options”: null,
“keyfile”: “/root/.ssh/authorized_keys”,
“manage_dir”: true,
“path”: null,
“state”: “present”,
“unique”: false,
“user”: “root”,
“validate_certs”: true
}
compute4 | CHANGED => {
“changed”: true,
“comment”: null,
“exclusive”: true,
“follow”: false,
“key”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGWq7V5gP6Wndq7ZJLXegs1j0djV+kfixuMST2AXaoRTUPvKazUdVTE3ulq/Tk443Vq96fUi+tnc9o95hOZmTYxfYlKucKgOk/AmFq/9oRHd2UFtZurVwIR0olD6A5NuXO4ksKvYjIqMM1dXmFJ2iG5+ODgm+y1u40oFj2Pz7HRft/mp1W06s4K3SF/L3RT8hVFCU0HGaRqsvx0D8TYDGluvbMKE6we235cOct5Od495Hgv+hJuPIsWpm4o6tU7+rLp9oTGl+xP2JKGpYNdZQX+XgqSRJ8ie3ccaAM3K0uEGbRTagB3bouGDWiP21CPH5pWvl94I7mnxr3wv8si+0l [email protected]”,
“key_options”: null,
“keyfile”: “/root/.ssh/authorized_keys”,
“manage_dir”: true,
“path”: null,
“state”: “present”,
“unique”: false,
“user”: “root”,
“validate_certs”: true
}
block1 | CHANGED => {
“changed”: true,
“comment”: null,
“exclusive”: true,
“follow”: false,
“key”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGWq7V5gP6Wndq7ZJLXegs1j0djV+kfixuMST2AXaoRTUPvKazUdVTE3ulq/Tk443Vq96fUi+tnc9o95hOZmTYxfYlKucKgOk/AmFq/9oRHd2UFtZurVwIR0olD6A5NuXO4ksKvYjIqMM1dXmFJ2iG5+ODgm+y1u40oFj2Pz7HRft/mp1W06s4K3SF/L3RT8hVFCU0HGaRqsvx0D8TYDGluvbMKE6we235cOct5Od495Hgv+hJuPIsWpm4o6tU7+rLp9oTGl+xP2JKGpYNdZQX+XgqSRJ8ie3ccaAM3K0uEGbRTagB3bouGDWiP21CPH5pWvl94I7mnxr3wv8si+0l [email protected]”,
“key_options”: null,
“keyfile”: “/root/.ssh/authorized_keys”,
“manage_dir”: true,
“path”: null,
“state”: “present”,
“unique”: false,
“user”: “root”,
“validate_certs”: true
}
controller1 | CHANGED => {
“changed”: true,
“comment”: null,
“exclusive”: true,
“follow”: false,
“key”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGWq7V5gP6Wndq7ZJLXegs1j0djV+kfixuMST2AXaoRTUPvKazUdVTE3ulq/Tk443Vq96fUi+tnc9o95hOZmTYxfYlKucKgOk/AmFq/9oRHd2UFtZurVwIR0olD6A5NuXO4ksKvYjIqMM1dXmFJ2iG5+ODgm+y1u40oFj2Pz7HRft/mp1W06s4K3SF/L3RT8hVFCU0HGaRqsvx0D8TYDGluvbMKE6we235cOct5Od495Hgv+hJuPIsWpm4o6tU7+rLp9oTGl+xP2JKGpYNdZQX+XgqSRJ8ie3ccaAM3K0uEGbRTagB3bouGDWiP21CPH5pWvl94I7mnxr3wv8si+0l [email protected]”,
“key_options”: null,
“keyfile”: “/root/.ssh/authorized_keys”,
“manage_dir”: true,
“path”: null,
“state”: “present”,
“unique”: false,
“user”: “root”,
“validate_certs”: true
}
compute6 | CHANGED => {
“changed”: true,
“comment”: null,
“exclusive”: true,
“follow”: false,
“key”: “ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGWq7V5gP6Wndq7ZJLXegs1j0djV+kfixuMST2AXaoRTUPvKazUdVTE3ulq/Tk443Vq96fUi+tnc9o95hOZmTYxfYlKucKgOk/AmFq/9oRHd2UFtZurVwIR0olD6A5NuXO4ksKvYjIqMM1dXmFJ2iG5+ODgm+y1u40oFj2Pz7HRft/mp1W06s4K3SF/L3RT8hVFCU0HGaRqsvx0D8TYDGluvbMKE6we235cOct5Od495Hgv+hJuPIsWpm4o6tU7+rLp9oTGl+xP2JKGpYNdZQX+XgqSRJ8ie3ccaAM3K0uEGbRTagB3bouGDWiP21CPH5pWvl94I7mnxr3wv8si+0l [email protected]”,
“key_options”: null,
“keyfile”: “/root/.ssh/authorized_keys”,
“manage_dir”: true,
“path”: null,
“state”: “present”,
“unique”: false,
“user”: “root”,
“validate_certs”: true
}

部署完成后测试一下

[[email protected] ansible]

# ansible all -m command -a ‘date’
compute4 | CHANGED | rc=0 >>
Wed Apr 10 04:26:39 EDT 2019

compute2 | CHANGED | rc=0 >>
Wed Apr 10 04:26:39 EDT 2019

compute5 | CHANGED | rc=0 >>
Wed Apr 10 04:26:39 EDT 2019

compute3 | CHANGED | rc=0 >>
Wed Apr 10 04:26:40 EDT 2019

controller1 | CHANGED | rc=0 >>
Wed Apr 10 04:26:40 EDT 2019

block1 | CHANGED | rc=0 >>
Wed Apr 10 04:26:40 EDT 2019

compute1 | CHANGED | rc=0 >>
Wed Apr 10 04:26:41 EDT 2019

compute6 | CHANGED | rc=0 >>
Wed Apr 10 04:26:42 EDT 2019

[[email protected] ansible]

# ansible all -m ping
compute5 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
compute2 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
compute3 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
compute1 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
compute4 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
compute6 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
controller1 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}
block1 | SUCCESS => {
“changed”: false,
“ping”: “pong”
}

部署完成后,先更新系统 yum -y upgrade,然后做后面的准备

此条目发表在OpenStack分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注