0

I used the following page https://docs.ansible.com/ansible/lxd_container_module.html to extract the below lxd example and put it into a YAML file:

>>> cat play.yaml

---
# An example for creating a Ubuntu container and install python
- hosts: localhost
  connection: local
  tasks:
    - name: Create a started container
      lxd_container:
        name: mycontainer
        state: started
        source:
          type: image
          mode: pull
          server: https://images.linuxcontainers.org
          protocol: lxd
          alias: ubuntu/xenial/amd64
        profiles: ["default"]
        wait_for_ipv4_addresses: true
        timeout: 600

However upon running it I receive the following error:

>>> ansible-playbook play.yaml 
ERROR! no action detected in task

The error appears to have been in '/root/play': line 6, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - name: Create a started container
      ^ here

The YAML file looks correctly formatted. I also checked ansible-doc -l | grep "lxd" however no results were returned.

What is causing the task to not run?

Greg
  • 1,657
  • 5
  • 27
  • 38

1 Answers1

1

lxd_container module was added in Ansible version 2.2. Check your Ansible version with ansible --version and update your Ansible installation if needed with pip install ansible --upgrade

Henrik Pingel
  • 9,380
  • 2
  • 28
  • 39