I am trying to run this playbook
---
- hosts: control
become: yes
tasks:
- name: Stop All Linux Containers
lxc_container: name={{ item }} state=started
with_items:
- app01
- app02
- lb01
- db01
the target host is localhost but it is failing and showing following error
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
After this I tried
pip install lxc-python2
(saw it from another stackoverflow post) But it is showing an error too
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
This may happen if you have not installed the lxc-dev
package. At the moment it happens that the debian repo doesn't contain it and you have to download from a third party like ubuntu
That dev package (lxc-dev), or pip is not needed to be present in target hosts for normal operation of lxc_container -Ansible module. Only python2 is required to be present in target hosts and those packages listed in LXC-container module documentation in management host (the one in which u run Ansible).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.