From 405c7b7ab3e7b8baee847ce3077c987e7e1b6767 Mon Sep 17 00:00:00 2001 From: Adam Chalkley <36716992+atc0005@users.noreply.github.com> Date: Wed, 17 Apr 2019 13:35:48 -0500 Subject: [PATCH] lxd_container: Create container via fingerprint (#52737) In addition to using creating container using image aliases, containers can also be created using fingerprints, provided that the playbook author provide alternate values for 'server', 'protocol' and swap out 'alias' for 'fingerprint'. +label: docsite_pr --- .../modules/cloud/lxd/lxd_container.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/ansible/modules/cloud/lxd/lxd_container.py b/lib/ansible/modules/cloud/lxd/lxd_container.py index 09bad09b309..8eb83a03500 100644 --- a/lib/ansible/modules/cloud/lxd/lxd_container.py +++ b/lib/ansible/modules/cloud/lxd/lxd_container.py @@ -181,6 +181,30 @@ EXAMPLES = ''' raw: apt-get install -y python when: python_install_check.rc == 1 +# An example for creating an Ubuntu 14.04 container using an image fingerprint. +# This requires changing 'server' and 'protocol' key values, replacing the +# 'alias' key with with 'fingerprint' and supplying an appropriate value that +# matches the container image you wish to use. +- hosts: localhost + connection: local + tasks: + - name: Create a started container + lxd_container: + name: mycontainer + state: started + source: + type: image + mode: pull + # Provides current (and older) Ubuntu images with listed fingerprints + server: https://cloud-images.ubuntu.com/releases + # Protocol used by 'ubuntu' remote (as shown by 'lxc remote list') + protocol: simplestreams + # This provides an Ubuntu 14.04 LTS amd64 image from 20150814. + fingerprint: e9a8bdfab6dc + profiles: ["default"] + wait_for_ipv4_addresses: true + timeout: 600 + # An example for deleting a container - hosts: localhost connection: local