Ansible 重启 VMware vCenter Server Appliance

问题描述

我想简单地使用 Ansible 重新启动 VCSA 作为开发工作流程的一部分。有人对如何这样做有任何想法吗?

https://kb.vmware.com/s/article/2147152

这通常是通过点击“shell”然后关闭/打开服务和/或“重启”来完成的

我一直在玩 ansible.raw,但它似乎无限期地挂起。

我尝试过的一些尝试:

任务:

- name: 'get into the shell'
  raw: 'shell'
  register: shell
- debug: msg="{{ shell }}"

- name: 'reboot'
  raw: 'reboot'
  register: reboot
- debug: msg="{{ reboot }}"

- name: Unconditionally reboot the machine with all defaults
  reboot:

解决方法

我通过手动进入每个系统并将默认 shell 更改为 /bin/bash 来解决此问题

https://communities.vmware.com/t5/vCenter-Server-Discussions/Access-to-VCSA-through-SSH-and-or-local-console-is-NOT-working/td-p/1816293

############

~# vi /etc/passwd

并将设备更改为 /bin/bash

root:x:0:0:root:/root:/bin/bash

还要确保从 /etc/ssh/sshd_config 启用了 root 的 ssh 访问