Getting error in ansible The lxc module is not importable Check the requirements

0 votes

I am working on ansible tool.

My task looks something like this:

- name: Create a started container
    lxc_container:
      name: test-container-started
      container_log: true
      template: ubuntu
      state: started
      template_options: --release trusty

I get the following errors:

> 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 anyone help me with this query?
Thanks
Jul 24, 2018 in Ansible by Damon Salvatore
• 5,980 points
2,511 views

1 answer to this question.

0 votes

Here is what you can try.

If you will use Debian or Ubuntu as host system there is already python-lxc package available.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
        ...

I hope it would resolve your query.

answered Jul 24, 2018 by Atul
• 10,240 points

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

What is the ask_pass module in Ansible?

Hi@akhtar, Ask_pass is the control module in an ...READ MORE

answered Aug 11, 2020 in Ansible by MD
• 95,460 points
3,085 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,738 views
0 votes
1 answer

How to use Ansible git module pull a branch with local changes?

You cannot achieve it using the git ...READ MORE

answered Jul 9, 2018 in Ansible by Atul
• 10,240 points
7,111 views
+1 vote
1 answer

Is it possible to append a large amount of text to a file using Ansible?

Here is concept which you can follow. blockinfile is ...READ MORE

answered Jul 30, 2018 in Ansible by Atul
• 10,240 points
14,740 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP