Intellipaat Back

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

So, i have been working on ansible tool.

This is what my task looks like:

- name: Create a started container

    lxc_container:

      name: test-container-started

      container_log: true

      template: ubuntu

      state: started

      template_options: --release trusty

this is the error i am getting:

> TASK: [lxc | Create a started container]

> **************************************  failed: [localhost] => {"failed": true, "parsed": false}

> BECOME-SUCCESS-azsyqtknxvlowmknianyqnmdhuggnanw failed=True msg='The

> lxc module is not importable. Check the requirements.' The lxc module

> is not importable. Check the requirements.

> FATAL: all hosts have already failed -- aborting

Can someone help me out ?

2 Answers

0 votes
by (41.4k points)

If you use Debian or Ubuntu as a host system, python-lxc package will be available already. The best way to install it is Ansible of course, just before lxc_container tasks:

tasks:

    - name: Install provisioning dependencies

      apt: name=python-lxc

    - name: Create docker1.lxc container

      lxc_container:

        name: docker1

        ...

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)

Try this out :

Heads up : if you are using Debian or Ubuntu as host system there is already python-lxc package available.

Use ansible to install it, it probably the best way, just before lxc_container tasks:

  tasks:

    - name: Install provisioning dependencies

      apt: name=python-lxc

    - name: Create docker1.lxc container

      lxc_container:

        name: docker1

        ...

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...