Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (2.3k points)

So I have been using ansible and trying to execute 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 mentioned is a localhost ,but it fails and the following error comes up:

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 that i tried this command:

pip install lxc-python2 

It also shows an error:

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

2 Answers

0 votes
by (41.4k points)

This error will occur mostly if you haven't you've not installed the lxc-dev package. In this situation, the Debian Repository does not have it and you have to use it from a third party like ubuntu.

If you are interested to learn DevOps, I would recommend this Intellipaat’s DevOps Training Course and fast-track your career.

0 votes
by (6.9k points)
Looks like you do not have  lxc-dev package installed. Try using third party like ubuntu, In your scenario the Debian Repository does not have it and you'll have to make use of a third party like ubuntu.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...