diff --git a/ansible/gold-master.yml b/ansible/gold-master.yml index e279e03d7ec78f34d72ad782b715ab6cfc5dc30b..b863ec89dc38496c364d2ff97be20ec008e96ef9 100644 --- a/ansible/gold-master.yml +++ b/ansible/gold-master.yml @@ -27,12 +27,5 @@ - container_base - hosts: localhost - tasks: - - name: stop container so it can be cloned - lxd_container: name=gold-master state=stopped timeout=10 - failed_when: false - - # When running 16.04 container under 14.04 may need to force stop. - # See: https://github.com/lxc/lxd/issues/2182 - - name: ensure container has stopped - lxd_container: name=gold-master state=stopped force_stop=true + roles: + - { role: lxd_stop, name: gold-master } diff --git a/ansible/roles/lxd_stop/tasks/main.yml b/ansible/roles/lxd_stop/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..97105b244478f87aa57c5421e63cc8b77db6d66b --- /dev/null +++ b/ansible/roles/lxd_stop/tasks/main.yml @@ -0,0 +1,15 @@ +# When running 16.04 container under 14.04 may need to force stop. +# See: https://github.com/lxc/lxd/issues/2182 + +- name: stop container so it can be cloned + lxd_container: + name: '{{name}}' + state: stopped + timeout: 10 + failed_when: false + +- name: ensure container has stopped + lxd_container: + name: '{{name}}' + state: stopped + force_stop: true