ansible - Ansible - 登录 Heroku
问题描述
通常使用终端登录是这样的
sudo heroku login --interactive
Email: My email
Password: My password
Login Successful!
这是我的角色
- name: Heroku login
expect:
command: heroku login --interactive
responses:
(?i)Email: '{{ heroku_email }}'
(?i)Password: '{{ heroku_password }}'
30秒后我得到了
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "heroku login --interactive", "delta": "0:00:31.545693", "end": "2020-04-02 20:06:40.838040", "msg": "command exceeded timeout", "rc": null, "start": "2020-04-02 20:06:09.292347", "stdout": " \u001b[33m›\u001b[39m Warning: heroku update available from \u001b[92m7.39.0\u001b[39m to \u001b[92m7.39.2\u001b[39m.\r\nheroku: Enter your login credentials\r\nEmail \u001b[33m[myemail@gmail.com]\u001b[39m: \u001b[2K\u001b[GPassword: ***********", "stdout_lines": [" \u001b[33m›\u001b[39m Warning: heroku update available from \u001b[92m7.39.0\u001b[39m to \u001b[92m7.39.2\u001b[39m.", "heroku: Enter your login credentials", "Email \u001b[33m[myemail@gmail.com]\u001b[39m: \u001b[2K\u001b[GPassword: ***********"]}
有人知道我为什么会收到这个错误吗?
解决方案
我花了两天时间做这个,我问社区 ansble 但不幸的是它失败了。我做了一个替代退出,即使用expect 脚本登录。它看起来像这样:
#!/usr/bin/expect
spawn heroku login -i
sleep 1
send "HEROKU_EMAIL";
send "\r"
sleep 1
send "HEROKU_PASSWORD"
sleep 1
send "\r"
sleep 2
interact
如果有人想要整个角色,请点击下面的链接
推荐阅读
- java - 2021年如何在jhipster中为我的实体添加新字段?
- node.js - node.js 中 2FA 的 infobip api 集成
- java - 如何在 vlcj-4 中更改视频
- python - 初始化 python ftplib 时的 socket.gaierror
- c# - 为什么冒泡排序比选择排序运行得快?
- python - python - 如何在python中打印大于列表特定数量的3个数字?
- python - 试图拟合涉及数值积分的函数并获得错误 TypeError: cannot unpack non-iterable numpy.float64 object
- r - 如何在 R 中的矩阵 for 循环中修复此错误结果?
- openssl - 将 pem 文件的数字从十六进制字符串转换为十进制
- angular - 无法使用 Plotly、Angular 12 显示曲面图