39889dfc2b
Instead of using two tasks, skipping the second if the first succeeds, this will execute the first and totally ignore the second if the first succeeds. The second will only execute if the first fails. This is more efficient to execute and gets rid of the rather horrible 'failed_when: false' on the first task. Change-Id: I90f9d95c5dadd0966a04dd7b02b540372d1807cf
59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
---
|
|
# Copyright 2014, Rackspace US, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- block:
|
|
- name: Create base container
|
|
lxc_container:
|
|
name: "LXC_NAME"
|
|
template: "download"
|
|
state: stopped
|
|
backing_store: "dir"
|
|
template_options: "{{ lxc_cache_download_template_options }} --keyserver {{ lxc_image_cache_primary_keyserver }}"
|
|
register: cache_download_primary
|
|
retries: 3
|
|
delay: 10
|
|
until: cache_download_primary | success
|
|
environment: "{{ lxc_cache_environment }}"
|
|
tags:
|
|
- lxc-cache
|
|
- lxc-cache-download
|
|
- lxc_hosts-install
|
|
|
|
rescue:
|
|
- name: Create base container
|
|
lxc_container:
|
|
name: "LXC_NAME"
|
|
template: "download"
|
|
state: stopped
|
|
backing_store: "dir"
|
|
template_options: "{{ lxc_cache_download_template_options }} --keyserver {{ lxc_image_cache_secondary_keyserver }}"
|
|
register: cache_download_secondary
|
|
retries: 3
|
|
delay: 10
|
|
until: cache_download_secondary | success
|
|
environment: "{{ lxc_cache_environment }}"
|
|
tags:
|
|
- lxc-cache
|
|
- lxc-cache-download
|
|
- lxc_hosts-install
|
|
|
|
- include: lxc_cache_preparation.yml
|
|
tags:
|
|
- lxc_hosts-config
|
|
|
|
- include: lxc_cache_create.yml
|
|
tags:
|
|
- lxc_hosts-config
|