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,510 points
278 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

Deploy Docker Containers from Docker Cloud

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

answered Sep 3, 2018 in AWS by Priyaj
• 56,520 points
136 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
1,281 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
2,250 views