首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在Ansible中使用lxc_container模块?

如何在Ansible中使用lxc_container模块?
EN

Stack Overflow用户
提问于 2016-03-25 00:24:45
回答 2查看 1.5K关注 0票数 1

我正在尝试运行这本手册

代码语言:javascript
运行
复制
---
- hosts: control
  become: yes
  tasks:
    - name: Stop All Linux Containers
      lxc_container: name={{ item }} state=started
      with_items:
        - app01
        - app02
        - lb01
        - db01

目标主机为localhost,但它出现故障并显示以下错误

代码语言:javascript
运行
复制
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

在这之后我试过了

代码语言:javascript
运行
复制
pip install lxc-python2 

(从另一个stackoverflow帖子中看到),但它也显示了一个错误

代码语言:javascript
运行
复制
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
EN

回答 2

Stack Overflow用户

发布于 2016-04-03 21:59:22

如果您尚未安装lxc-dev软件包,则可能会发生这种情况。目前,debian repo不包含它,您必须从第三方下载,如ubuntu

票数 2
EN

Stack Overflow用户

发布于 2016-09-25 20:41:46

对于lxc_container -Ansible模块的正常操作,目标主机中不需要存在该开发包(lxc- dev )或pip。只需要在目标主机和管理主机(在其中运行Ansible的主机)中的LXC- python2模块文档中列出的包中存在容器。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36205153

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档