安装ha主机需要sshpass
docker 下安装sshpass
$ docker exec -it ha bash
apk add --update --no-cache sshpass
安装成功后 添加configuration文件
switch:
- platform: command_line
switches:
centos:
command_on: "sshpass -p password ssh -o stricthostkeychecking=no -p22 root@192.168.1.76 'vim-cmd vmsvc/power.on 4'"
command_off: "sshpass -p password ssh -o stricthostkeychecking=no -p22 root@192.168.1.76 'vim-cmd vmsvc/power.off 4'"
command_state: "sshpass -p password ssh -o stricthostkeychecking=no -p22 root@192.168.1.76'vim-cmd vmsvc/power.getstate 4|grep on|wc -l'"
value_template: '{{ value == "1" }}'
friendly_name: 虚拟机WIN7开关
转载请注明出处