无法通过Ansible在Ubuntu 20.04 GCP虚拟机安装Scala和SBT
在Ubuntu 20.04 GCP虚拟机上通过Ansible安装Scala和SBT的失败经历
我尝试用Ansible自动化工具,在运行Ubuntu 20.04的GCP虚拟机上安装Scala和SBT,但多次尝试均未成功:
首次尝试:使用SDKMAN
按照SDKMAN官网指引编写Ansible Playbook安装Scala 2.12.8,执行后报错:
"stderr": "/bin/bash: /home/my_user_name/.sdkman/bin/sdkman-init.sh: No such file or directory
但SSH登录虚拟机手动执行命令无问题。
第二次尝试:修改SDKMAN方案
参考gist采用类似方法,出现相同错误。
第三次尝试:手动安装
参考教程手动编写Playbook,更新apt缓存时失败:
FAILED! => {"changed": false, "msg": "Failed to update apt cache: W:Updating from such a repository can't be done securely, and is therefore disabled by default., W:See apt-secure(8) manpage for repository creation and user configuration details
第四次尝试:使用专用Role
采用Comcast.sdkman角色配置安装,报错:
FAILED! => {"changed": false, "cmd": "set -o pipefail\ngetent passwd sudo | cut -d: -f6\n", "delta": "0:00:00.007774", "end": "2023-09-28 19:27:22.770244", "msg": "non-zero return code", "rc": 2, "start": "2023-09-28 19:27:22.762470", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
内容的提问来源于stack exchange,提问作者SkogensKonung
相关产品推荐
相关产品推荐

