我正在尝试运行这本手册
---
- hosts: control
become: yes
tasks:
- name: Stop All Linux Containers
lxc_container: name={{ item }} state=started
with_items:
- app01
- app02
- lb01
- db01
目标主机为localhost,但它出现故障并显示以下错误
failed: [127.0.0.1] => (item=app01) => {"failed": true, "item": "app01", "parsed": false}
BECOME-SUCCESS-rppgggxcewgndkgtnpptrgeglbfykput
failed=True msg='The lxc module is not importable. Check the requirements.'
The lxc module is not importable. Check the requirements
在这之后我试过了
pip install lxc-python2
(从另一个stackoverflow帖子中看到),但它也显示了一个错误
lxc.c:27:30: fatal error: lxc/lxccontainer.h: No such file or directory
#include <lxc/lxccontainer.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_dhruv/lxc-python2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZKdf9M-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_dhruv/lxc-python2
Storing debug log for failure in /home/dhruv/.pip/pip.log
发布于 2016-04-03 21:59:22
如果您尚未安装lxc-dev
软件包,则可能会发生这种情况。目前,debian repo不包含它,您必须从第三方下载,如ubuntu
发布于 2016-09-25 20:41:46
对于lxc_container -Ansible模块的正常操作,目标主机中不需要存在该开发包(lxc- dev )或pip。只需要在目标主机和管理主机(在其中运行Ansible的主机)中的LXC- python2模块文档中列出的包中存在容器。
https://stackoverflow.com/questions/36205153
复制相似问题