Merge "Add conditions to ceph roles for dependencies"

This commit is contained in:
Zuul 2019-10-31 12:42:59 +00:00 committed by Gerrit Code Review
commit de0d5bca20
11 changed files with 71 additions and 20 deletions

View File

@ -14,9 +14,6 @@
# License for the specific language governing permissions and limitations
# under the License.
# "tripleo-ceph-common" will search for and load any operating system variable file
- name: set basic user fact
set_fact:
ansible_user: "{{ lookup('env', 'USER') }}"
@ -29,17 +26,20 @@
when:
- ansible_user_dir is undefined
- name: set default for calling_ansible_environment_variables
set_fact:
calling_ansible_environment_variables: []
- when: ceph_ansible_inherits_calling_ansible_environment
- name: Local environment inherit
when:
- (ceph_ansible_inherits_calling_ansible_environment | default(false)) | bool
block:
- name: get all ansible environment variables
shell: "env | grep ANSIBLE_"
register: env_shell_output
ignore_errors: true
delegate_to: localhost
connection: local
run_once: true
- name: set calling_ansible_environment_variables
run_once: true
set_fact:
calling_ansible_environment_variables: "{{ env_shell_output.stdout_lines }}"
when:
@ -47,3 +47,7 @@
- env_shell_output.rc == 0
- env_shell_output.stdout_lines is defined
- (env_shell_output.stdout_lines|length) > 0
- name: Set common fact
set_fact:
ceph_common_done: true

View File

@ -0,0 +1,17 @@
---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
calling_ansible_environment_variables: []

View File

@ -39,5 +39,9 @@ galaxy_info:
- tripleo
dependencies:
- tripleo-ceph-common
- tripleo-ceph-work-dir
- role: tripleo-ceph-common
when:
- ceph_common_done is undefined
- role: tripleo-ceph-work-dir
when:
- ceph_ansible_private_key_file is undefined

View File

@ -87,3 +87,7 @@
when:
- curl_get_http_status is changed
- curl_get_http_status.stdout == "200"
- name: Set cleaned fact
set_fact:
ceph_node_cleaned: true

View File

@ -39,7 +39,15 @@ galaxy_info:
- tripleo
dependencies:
- tripleo-ceph-common
- tripleo-ceph-work-dir
- tripleo-ceph-fetch-dir
- tripleo-ceph-uuid
- role: tripleo-ceph-common
when:
- ceph_common_done is undefined
- role: tripleo-ceph-work-dir
when:
- ceph_ansible_private_key_file is undefined
- role: tripleo-ceph-fetch-dir
when:
- ceph_node_cleaned is undefined
- role: tripleo-ceph-uuid
when:
- (nodes_uuid_list is undefined) or (nodes_data is undefined)

View File

@ -39,5 +39,9 @@ galaxy_info:
- tripleo
dependencies:
- tripleo-ceph-common
- tripleo-ceph-work-dir
- role: tripleo-ceph-common
when:
- ceph_common_done is undefined
- role: tripleo-ceph-work-dir
when:
- ceph_ansible_private_key_file is undefined

View File

@ -15,4 +15,8 @@
# under the License.
- import_tasks: prepare.yml
when:
- nodes_data is undefined
- import_tasks: gather.yml
when:
- nodes_uuid_list is undefined

View File

@ -39,4 +39,6 @@ galaxy_info:
- tripleo
dependencies:
- tripleo-ceph-common
- role: tripleo-ceph-common
when:
- ceph_common_done is undefined

View File

@ -22,4 +22,5 @@
- name: set private key file
set_fact:
ceph_ansible_private_key_file: "{{ playbook_dir }}/ssh_private_key"
when: ceph_ansible_private_key_file is not defined and detect_private_key_file.stat.exists
when:
- detect_private_key_file.stat.exists | bool

View File

@ -16,3 +16,5 @@
- import_tasks: prepare.yml
- import_tasks: get_ssh_private_key.yml
when:
- ceph_ansible_private_key_file is undefined

View File

@ -34,6 +34,7 @@
src: "{{ inventory_file }}"
dest: "{{ playbook_dir }}/ceph-ansible/inventory.yml"
state: link
force: true
tags:
- run_uuid_ansible
- run_ceph_ansible
@ -41,9 +42,9 @@
- name: generate ceph-ansible group vars all
copy:
dest: "{{ playbook_dir }}/ceph-ansible/group_vars/all.yml"
content: "{{ ceph_ansible_group_vars_all|to_nice_yaml }}"
content: "{{ ceph_ansible_group_vars_all | to_nice_yaml }}"
- name: generate ceph-ansible extra vars
copy:
dest: "{{ playbook_dir }}/ceph-ansible/extra_vars.yml"
content: "{{ ceph_ansible_extra_vars|to_nice_yaml }}"
content: "{{ ceph_ansible_extra_vars | to_nice_yaml }}"