2016-03-24 6 views
1

Ich versuche, diese TextbuchWie lxc_container Modul in Ansible verwenden?

--- 
- hosts: control 
    become: yes 
    tasks: 
    - name: Stop All Linux Containers 
     lxc_container: name={{ item }} state=started 
     with_items: 
     - app01 
     - app02 
     - lb01 
     - db01 

der Ziel-Host ist localhost, aber es schlägt fehl und zeigt folgende Fehler

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 

Danach ich

pip install lxc-python2 

(sah es versuchte zu laufen von einem anderen Stapelüberlauf post) Aber es zeigt auch einen Fehler

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 

Antwort

2

Dies kann passieren, wenn Sie das Paket lxc-dev nicht installiert haben. Im Moment kommt es vor, dass der Debian-Repo es nicht enthält und Sie müssen von einer dritten Partei wie ubuntu

+0

hatte denselben Fehler in dieser Frage und lxc-dev hat den Trick! Vielen Dank – Deano

0

herunterladen Das dev-Paket (lxc-dev), oder Pip wird nicht benötigt, um in Ziel-Hosts für vorhanden sein Normaler Betrieb von lxc_container -Ansible-Modul. Nur python2 muss auf den Zielhosts vorhanden sein und die Pakete, die in der Dokumentation zum LXC-Containermodul im Management-Host aufgeführt sind (der, in dem Ansible ausgeführt wird).

Verwandte Themen