DRY when installing components
collect source/git info into a list and use it via `with_items` when cloning/local copying sources. Also, use git module with appropriate arguments instead of calling git 4 times through command module. Change-Id: Ia0be4b64b849cac1c32da02b2492ce026233d8b7
This commit is contained in:
parent
7a6fa591a1
commit
aa38052400
@ -29,3 +29,33 @@ reqs_git_branch: master
|
|||||||
# Conditional variables utilized based on CI or manual testing options.
|
# Conditional variables utilized based on CI or manual testing options.
|
||||||
copy_from_local_path: false
|
copy_from_local_path: false
|
||||||
ci_testing_zuul: false
|
ci_testing_zuul: false
|
||||||
|
|
||||||
|
bifrost_install_sources:
|
||||||
|
- git_folder: "{{ ironic_git_folder }}"
|
||||||
|
git_url: "{{ ironic_git_url }}"
|
||||||
|
git_branch: "{{ ironic_git_branch }}"
|
||||||
|
name: ironic
|
||||||
|
- git_folder: "{{ ironicclient_git_folder }}"
|
||||||
|
git_url: "{{ ironicclient_git_url }}"
|
||||||
|
git_branch: "{{ ironicclient_git_branch }}"
|
||||||
|
name: ironicclient
|
||||||
|
- git_folder: "{{ shade_git_folder }}"
|
||||||
|
git_url: "{{ shade_git_url }}"
|
||||||
|
git_branch: "{{ shade_git_branch }}"
|
||||||
|
name: shade
|
||||||
|
- git_folder: "{{ dib_git_folder }}"
|
||||||
|
git_url: "{{ dib_git_url }}"
|
||||||
|
git_branch: "{{ dib_git_branch }}"
|
||||||
|
name: dib
|
||||||
|
- git_folder: "{{ ironicinspector_git_folder }}"
|
||||||
|
git_url: "{{ ironicinspector_git_url }}"
|
||||||
|
git_branch: "{{ ironicinspector_git_branch }}"
|
||||||
|
name: ironicinspector
|
||||||
|
- git_folder: "{{ ironicinspectorclient_git_folder }}"
|
||||||
|
git_url: "{{ ironicinspectorclient_git_url }}"
|
||||||
|
git_branch: "{{ ironicinspectorclient_git_branch }}"
|
||||||
|
name: ironicinspectorclient
|
||||||
|
- git_folder: "{{ reqs_git_folder }}"
|
||||||
|
git_url: "{{ reqs_git_url }}"
|
||||||
|
git_branch: "{{ reqs_git_branch }}"
|
||||||
|
name: requirements
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
---
|
|
||||||
- name: "Clone repository"
|
|
||||||
command: git clone {{ git_url }} {{ git_folder }} chdir={{ git_root }} creates={{ git_folder }}
|
|
||||||
|
|
||||||
- name: "Check out branch"
|
|
||||||
command: git checkout -f {{ git_branch }} chdir={{ git_folder }}
|
|
||||||
|
|
||||||
- name: "Reset local repository"
|
|
||||||
command: git reset --hard {{ git_branch }} chdir={{ git_folder }}
|
|
||||||
|
|
||||||
- name: "Resync local repository"
|
|
||||||
command: git pull --ff-only chdir={{ git_folder }}
|
|
@ -1,49 +0,0 @@
|
|||||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
---
|
|
||||||
- include: git.yml
|
|
||||||
git_url="{{ ironic_git_url }}"
|
|
||||||
git_folder="{{ ironic_git_folder }}"
|
|
||||||
git_branch="{{ ironic_git_branch }}"
|
|
||||||
|
|
||||||
- include: git.yml
|
|
||||||
git_url="{{ ironicclient_git_url }}"
|
|
||||||
git_folder="{{ ironicclient_git_folder }}"
|
|
||||||
git_branch="{{ ironicclient_git_branch }}"
|
|
||||||
|
|
||||||
- include: git.yml
|
|
||||||
git_url="{{ shade_git_url }}"
|
|
||||||
git_folder="{{ shade_git_folder }}"
|
|
||||||
git_branch="{{ shade_git_branch }}"
|
|
||||||
|
|
||||||
- include: git.yml
|
|
||||||
git_url="{{ dib_git_url }}"
|
|
||||||
git_folder="{{ dib_git_folder }}"
|
|
||||||
git_branch="{{ dib_git_branch }}"
|
|
||||||
|
|
||||||
- include: git.yml
|
|
||||||
git_url="{{ ironicinspector_git_url }}"
|
|
||||||
git_folder="{{ ironicinspector_git_folder }}"
|
|
||||||
git_branch="{{ ironicinspector_git_branch }}"
|
|
||||||
|
|
||||||
- include: git.yml
|
|
||||||
git_url="{{ ironicinspectorclient_git_url }}"
|
|
||||||
git_folder="{{ ironicinspectorclient_git_folder }}"
|
|
||||||
git_branch="{{ ironicinspectorclient_git_branch }}"
|
|
||||||
|
|
||||||
- include: git.yml
|
|
||||||
git_url="{{ reqs_git_url }}"
|
|
||||||
git_folder="{{ reqs_git_folder }}"
|
|
||||||
git_branch="{{ reqs_git_branch }}"
|
|
@ -1,35 +0,0 @@
|
|||||||
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
---
|
|
||||||
- name: "ironic - Copy into place"
|
|
||||||
command: cp -a {{ ironic_git_url }} {{ ironic_git_folder }} chdir={{ git_root }} creates={{ ironic_git_folder }}
|
|
||||||
|
|
||||||
- name: "python-ironicclient - Copy into place"
|
|
||||||
command: cp -a {{ ironicclient_git_url }} {{ ironicclient_git_folder }} chdir={{ git_root }} creates={{ ironicclient_git_folder }}
|
|
||||||
|
|
||||||
- name: "Shade - Copy into place"
|
|
||||||
command: cp -a {{ shade_git_url }} {{ shade_git_folder }} chdir={{ git_root }} creates={{ shade_git_folder }}
|
|
||||||
|
|
||||||
- name: "Disk Image Builder - Copy into place"
|
|
||||||
command: cp -a {{ dib_git_url }} {{ dib_git_folder }} chdir={{ git_root }} creates={{ dib_git_folder }}
|
|
||||||
|
|
||||||
- name: "ironic-inspector - Copy into place"
|
|
||||||
command: cp -a {{ ironicinspector_git_url }} {{ ironicinspector_git_folder }} chdir={{ git_root }} creates={{ ironicinspector_git_folder }}
|
|
||||||
|
|
||||||
- name: "python-ironic-inspector-client - Copy into place"
|
|
||||||
command: cp -a {{ ironicinspectorclient_git_url }} {{ ironicinspectorclient_git_folder }} chdir={{ git_root }} creates={{ ironicinspectorclient_git_folder }}i
|
|
||||||
|
|
||||||
- name: "Clone upper requirements"
|
|
||||||
command: cp -a {{ reqs_git_url }} {{ reqs_git_folder }} chdir={{ git_root }} creates={{ reqs_git_folder }}
|
|
@ -21,9 +21,17 @@
|
|||||||
group: "{{ ansible_user_gid }}"
|
group: "{{ ansible_user_gid }}"
|
||||||
|
|
||||||
- name: "Download via GIT"
|
- name: "Download via GIT"
|
||||||
include: git_download.yaml
|
git:
|
||||||
|
dest: "{{ item.git_folder }}"
|
||||||
|
force: yes
|
||||||
|
repo: "{{ item.git_url }}"
|
||||||
|
version: "{{ item.git_branch }}"
|
||||||
|
update: yes
|
||||||
|
clone: yes
|
||||||
|
with_items: "{{ bifrost_install_sources }}"
|
||||||
when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false
|
when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false
|
||||||
|
|
||||||
- name: "Copy from local path"
|
- name: "Copy from local path"
|
||||||
include: local_path.yaml
|
command: cp -a {{ item.git_url }} {{ item.git_folder }} creates={{ item.git_folder }}
|
||||||
|
with_items: "{{ bifrost_install_sources }}"
|
||||||
when: ci_testing_zuul | bool == true or copy_from_local_path | bool == true
|
when: ci_testing_zuul | bool == true or copy_from_local_path | bool == true
|
||||||
|
Loading…
Reference in New Issue
Block a user