我想在我的Raspberry Pi(raspbian / jessie)上安装Ansible,以便我可以维护它。不幸的是,我似乎无法安装它。到目前为止,我已尝试过APT和PIP但每个都有障碍。
pi@retropie:~ $ sudo apt-add-repository ppa:ansible/ansible
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 167, in <module>
sp = SoftwareProperties(options=options)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 105, in __init__
self.reload_sourceslist()
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 595, in reload_sourceslist
self.distro.get_sources(self.sourceslist)
File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
(self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/jessie
pi@retropie:~ $ sudo pip install ansible
Downloading/unpacking ansible
Downloading ansible-2.4.1.0.tar.gz (6.7MB): 6.7MB downloaded
no previously-included directories found matching 'ticket_stubs'
no previously-included directories found matching 'hacking'
Downloading/unpacking jinja2 (from ansible)
Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB): 340kB downloaded
Downloading/unpacking PyYAML (from ansible)
Downloading PyYAML-3.12.tar.gz (253kB): 253kB downloaded
Running setup.py (path:/tmp/pip-build-bsUTB2/PyYAML/setup.py) egg_info for package PyYAML
Downloading/unpacking paramiko (from ansible)
Downloading paramiko-2.3.1-py2.py3-none-any.whl (182kB): 182kB downloaded
Downloading/unpacking cryptography (from ansible)
Downloading cryptography-2.1.2.tar.gz (441kB): 441kB downloaded
Running setup.py (path:/tmp/pip-build-bsUTB2/cryptography/setup.py) egg_info for package cryptography
error in cryptography setup command: Invalid environment marker: python_version < '3'
Complete output from command python setup.py egg_info:
error in cryptography setup command: Invalid environment marker: python_version < '3'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-bsUTB2/cryptography
Storing debug log for failure in /root/.pip/pip.log
从上面的错误可以看出,&#34;加密&#34;表明它需要&gt; python3 我看了installation requirements,发现你需要python 3.5+如果你使用3.Rasbian附带3.4 ......
然后我尝试使用几个ppa(ppa:jonathonf / python-3.6和ppa:deadsnakes / ppa)安装python 3.6,但是还没有可用于raspbian / jessie的发行版。
之后我开始考虑从源代码下拉并编译python,但我期待着我会遇到另一个障碍。
总之,有没有人有任何想法如何在Raspberry Pi上安装Ansible?
答案 0 :(得分:2)
Jessie于2015年发布,正式淘汰。 Stretch是当前的Raspbian repo,它有python3.5而不添加PPA。
然后,您只需使用pip3安装Ansible。
答案 1 :(得分:2)
这个问题有点老了,但是在谷歌上搜索如何在Raspbian上安装Ansible时出现的第一个结果是,我想我会对其进行更新。如果您正在伸展运动(或轻度伸展运动)
你可以做
sudo apt-get install ansible
但是,目前Raspbian储存库中的Ansbile版本是2.2,这有点旧
按照Ansible installation page中的说明进行一些修改(以克服一些错误),您可以执行以下操作:
首次运行
sudo apt-get install dirmngr
编辑您的/etc/apt/sources.list
并追加
deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main
然后运行
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt-get update
sudo apt-get install ansible
到今天为止,这将为您提供2.7.8版本。
经过编辑以包括缺少的命令(感谢SpacePope)和正确的格式。