From 5c0b09ea00d7bb12219a420a69d9249e337c0f9b Mon Sep 17 00:00:00 2001 From: Brian Candler Date: Thu, 7 Jul 2016 10:38:40 +0000 Subject: [PATCH] Factor out lxd_stop role --- ansible/gold-master.yml | 11 ++--------- ansible/roles/lxd_stop/tasks/main.yml | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 ansible/roles/lxd_stop/tasks/main.yml diff --git a/ansible/gold-master.yml b/ansible/gold-master.yml index e279e03..b863ec8 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 0000000..97105b2 --- /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 -- GitLab