Ansible-登录到heroku
通常使用终端登录是这样的Ansible-登录到heroku,ansible,heroku-cli,Ansible,Heroku Cli,通常使用终端登录是这样的 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)Passwor
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: ***********"]}
有人知道我为什么会出错吗?expect模块的默认超时为30秒。从stdout可以看出expect对这两个提示都做出了响应 登录时间可能超过默认超时时间。增加任务的超时时间
- name: Heroku login
expect:
command: heroku login --interactive
responses:
(?i)Email: '{{ heroku_email }}'
(?i)Password: '{{ heroku_password }}'
timeout: 300
expect
模块的默认超时为30秒。从stdout可以看出expect对这两个提示都做出了响应
登录时间可能超过默认超时时间。增加任务的超时时间
- name: Heroku login
expect:
command: heroku login --interactive
responses:
(?i)Email: '{{ heroku_email }}'
(?i)Password: '{{ heroku_password }}'
timeout: 300
我花了两天的时间来做这件事,我向社区询问了一些问题,但不幸的是失败了。我选择退出,即使用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
如果有人想要整个角色,请点击下面的链接
我花了两天的时间来做这件事,我向社区咨询,但不幸的是失败了。我选择退出,即使用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
如果有人想要整个角色,请点击下面的链接
谢谢你的回答,但这不是问题所在。我将超时值设置为300,并具有相同的效果。通过终端手动登录最多需要两秒钟。谢谢您的回答,但这不是问题所在。我将超时值设置为300,并具有相同的效果。通过终端手动登录最多需要两秒钟。请考虑解释如何以及为什么这解决了问题,以便它可以使其他用户受益。请考虑解释如何以及为什么这解决了问题,以便它可以受益于其他用户。