ansible无法验证目标目录

问题描述 投票:1回答:1

我正在尝试使用packer在circleci中调用ansible。我正在运行ansible版本2.9.4,打包程序1.5.1和alpine edge。当我在此脚本上运行packer build base_ami "provisioners": [ { "type": "ansible", "playbook_file": "/root/project/Packer_file/ansible/main.yml", "extra_arguments": [ "--extra-vars", "BUNDLE_VERSION={{userami_bundle_version }}" ] } ]

我收到以下错误 Ruby_Node base golden-ami: PLAY [Setup Golden AMIs] ******************************************************* Ruby_Node base golden-ami: Ruby_Node base golden-ami: TASK [Gathering Facts] ********************************************************* Ruby_Node base golden-ami: fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo /root/.ansible/tmp/ansible-tmp-1580765671.6926048-217217096224757 `\" && echo ansible-tmp-1580765671.6926048-217217096224757=\"` echo /root/.ansible/tmp/ansible-tmp-1580765671.6926048-217217096224757 `\" ), exited with result 1", "unreachable": true} Ruby_Node base golden-ami: Ruby_Node base golden-ami: PLAY RECAP ********************************************************************* Ruby_Node base golden-ami: default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

有人知道这里有什么问题吗?

python-3.x ansible circleci packer
1个回答
1
投票

通过添加用户解决了问题

"provisioners": [
    {
      "type": "ansible",
      "playbook_file": "/root/project/Packer_file/ansible/main.yml",
      "user": "ansible",
      "extra_arguments": [
        "--extra-vars", "BUNDLE_VERSION={{userami_bundle_version}}"
      ]
    }
  ]

© www.soinside.com 2019 - 2024. All rights reserved.