Optimise the distro package installation
In order to optimise the distro package installation process the list of packages to install is prepared for the host, then installed by passing the package task the full list instead of using a loop. Change-Id: I8bae6b5a39f78a2ee4fb02e31d91c1dd3eca7cb0
This commit is contained in:
parent
d513189a65
commit
6ba2290a5f
@ -23,8 +23,6 @@ cinder_git_install_branch: master
|
|||||||
cinder_developer_mode: false
|
cinder_developer_mode: false
|
||||||
cinder_developer_constraints:
|
cinder_developer_constraints:
|
||||||
- "git+{{ cinder_git_repo }}@{{ cinder_git_install_branch }}#egg=cinder"
|
- "git+{{ cinder_git_repo }}@{{ cinder_git_install_branch }}#egg=cinder"
|
||||||
cinder_developer_mode_packages:
|
|
||||||
- git
|
|
||||||
|
|
||||||
# Name of the virtual env to deploy into
|
# Name of the virtual env to deploy into
|
||||||
cinder_venv_tag: untagged
|
cinder_venv_tag: untagged
|
||||||
|
@ -15,57 +15,14 @@
|
|||||||
|
|
||||||
- name: Install distro packages
|
- name: Install distro packages
|
||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ cinder_package_list }}"
|
||||||
state: "{{ cinder_package_state }}"
|
state: "{{ cinder_package_state }}"
|
||||||
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
|
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
|
||||||
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
||||||
register: install_packages
|
register: install_packages
|
||||||
until: install_packages|success
|
until: install_packages | success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
with_items: "{{ cinder_distro_packages }}"
|
|
||||||
|
|
||||||
- name: Install distro packages common between different backends
|
|
||||||
package:
|
|
||||||
name: "{{ item }}"
|
|
||||||
state: "{{ cinder_package_state }}"
|
|
||||||
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
|
|
||||||
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
|
||||||
register: install_packages
|
|
||||||
until: install_packages|success
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
with_items: "{{ cinder_volume_distro_packages }}"
|
|
||||||
when:
|
|
||||||
- inventory_hostname in groups['cinder_volume']
|
|
||||||
|
|
||||||
- name: Install distro packages for LVM backend
|
|
||||||
package:
|
|
||||||
name: "{{ item }}"
|
|
||||||
state: "{{ cinder_package_state }}"
|
|
||||||
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
|
|
||||||
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
|
||||||
register: install_packages
|
|
||||||
until: install_packages|success
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
with_items: "{{ cinder_lvm_volume_distro_packages }}"
|
|
||||||
when:
|
|
||||||
- inventory_hostname in groups['cinder_volume']
|
|
||||||
- cinder_backend_lvm_inuse | bool
|
|
||||||
|
|
||||||
- name: Install distro packages for developer_mode installs
|
|
||||||
package:
|
|
||||||
name: "{{ item }}"
|
|
||||||
state: "{{ cinder_package_state }}"
|
|
||||||
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
|
|
||||||
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
|
||||||
register: install_packages
|
|
||||||
until: install_packages|success
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
with_items: "{{ cinder_developer_mode_packages }}"
|
|
||||||
when: cinder_developer_mode | bool
|
|
||||||
|
|
||||||
- name: Create developer mode constraint file
|
- name: Create developer mode constraint file
|
||||||
copy:
|
copy:
|
||||||
|
@ -13,6 +13,28 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Compile a list of the distro packages to install based on
|
||||||
|
# whether the host is in the host group and the service is
|
||||||
|
# enabled.
|
||||||
|
#
|
||||||
|
cinder_package_list: |-
|
||||||
|
{% set packages = cinder_distro_packages %}
|
||||||
|
{% if cinder_services['cinder-volume']['group'] in group_names %}
|
||||||
|
{% set _ = packages.extend(cinder_volume_distro_packages) %}
|
||||||
|
{% if cinder_backend_lvm_inuse | bool %}
|
||||||
|
{% set _ = packages.extend(cinder_lvm_volume_distro_packages) %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if cinder_developer_mode | bool %}
|
||||||
|
{% set _ = packages.extend(cinder_developer_mode_distro_packages) %}
|
||||||
|
{% endif %}
|
||||||
|
{{ packages }}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Compile a list of the services on a host based on whether
|
||||||
|
# the host is in the host group and the service is enabled.
|
||||||
|
#
|
||||||
filtered_cinder_services: >
|
filtered_cinder_services: >
|
||||||
{%- set services = cinder_services.copy() %}
|
{%- set services = cinder_services.copy() %}
|
||||||
{%- for key,value in cinder_services.items() %}
|
{%- for key,value in cinder_services.items() %}
|
||||||
|
@ -28,6 +28,9 @@ cinder_distro_packages:
|
|||||||
- which
|
- which
|
||||||
- iscsi-initiator-utils
|
- iscsi-initiator-utils
|
||||||
|
|
||||||
|
cinder_developer_mode_distro_packages:
|
||||||
|
- git
|
||||||
|
|
||||||
cinder_volume_distro_packages:
|
cinder_volume_distro_packages:
|
||||||
- qemu-img-ev
|
- qemu-img-ev
|
||||||
|
|
||||||
|
@ -35,6 +35,9 @@ cinder_distro_packages:
|
|||||||
- libssl-dev
|
- libssl-dev
|
||||||
- open-iscsi
|
- open-iscsi
|
||||||
|
|
||||||
|
cinder_developer_mode_distro_packages:
|
||||||
|
- git-core
|
||||||
|
|
||||||
cinder_volume_distro_packages:
|
cinder_volume_distro_packages:
|
||||||
- qemu-utils
|
- qemu-utils
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user