我正在运行Travis CI中的ansible2.2.0.0,以便安装我们在项目中使用的Terraform的公共共享版本。在
我可以在本地运行它而不会出现问题,但是当我在Travis中运行它时,它似乎无法对来自变量的字符串进行编码:
[WARNING]: Host file not found: /etc/ansible/hosts
[WARNING]: provided hosts list is empty, only localhost is available
PLAY [localhost] ***************************************************************
TASK [setup] *******************************************************************
ok: [localhost]
TASK [terraform : create terraform directory] **********************************
changed: [localhost]
TASK [terraform : install terraform] *******************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failure downloading https://releases.hashicorp.com/terraform/0.7.13/terraform_0.7.13_linux_amd64.zip, write() argument must be str, not bytes"}
PLAY RECAP *********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=1
主机Ansible和Python版本:
^{pr2}$Travis Ansible和Python版本:
$ python --version
Python 3.4.2
$ ansible --version
ansible 2.2.0.0
config file =
configured module search path = Default w/o overrides
我已经验证了LANG
在这两个地方都是en_US.UTF-8
。在
这是我的剧本:
---
- hosts: localhost
roles:
- role: terraform
terraform_install_root: "{{ ansible_env.HOME }}/terraform/"
bin_dir: "{{ ansible_env.HOME }}/.local/bin"
这是roles/terraform/tasks/main.yml
:
---
- name: create terraform directory
file: path={{ terraform_install_root }}/{{ terraform_version }} state=directory
- name: install terraform
unarchive:
copy: no
src: "https://releases.hashicorp.com/terraform/{{ terraform_version }}/terraform_{{ terraform_version }}_linux_amd64.zip"
dest: "{{ terraform_install_root }}/{{ terraform_version }}"
creates: "{{ terraform_install_root }}/{{ terraform_version }}/terraform"
- name: ensure bin directory exists
file: path={{ bin_dir }} state=directory
- name: create terraform symlink
file: src={{ terraform_install_root }}/{{ terraform_version }}/terraform dest={{ bin_dir }}/terraform state=link
以下是roles/terraform/vars/main.yml
:
---
terraform_version: "0.7.13"
terraform_install_root: /opt/terraform/
bin_dir: /usr/local/bin
似乎出于某种原因,Ansible未能将某些东西转换成UTF-8,尽管我没有做任何奇怪的事情,而在Travis上运行的本地运行的很好。在
此外,这些文件中似乎没有非ASCII字符:
$ file -i ansible/roles/terraform/tasks/main.yml
ansible/roles/terraform/tasks/main.yml: text/plain; charset=us-ascii
$ file -i ansible/roles/terraform/vars/main.yml
ansible/roles/terraform/vars/main.yml: text/plain; charset=us-ascii
$ file -i ansible/travis-playbook.yml
ansible/travis-playbook.yml: text/plain; charset=us-ascii
有什么想法吗?在
尽管如此,我还是升级到使用Travis的
trusty
(ubuntu14.04)的imagebeta版本,问题就解决了。在应该注意的是,
precise
是Ubuntu12.04,它是4岁的,快5岁了。在请使用此任务的
src
左右的引号:然后运行它:
^{pr2}$这是一个已知的Ansible错误(#5791),已经在
develop
中修复,尽管它还没有发布(commit ansible/ansible@1963e50)。在也许您可以在目标主机上安装一个单独的2.7python来使用Ansible?{3{3}在游戏中,你可以用一个{3}来积极地配置{3}游戏中的{n3}可以使用{n3}来配置游戏中的公平性。在
相关问题 更多 >
编程相关推荐