storlets/install/storlets/roles/host_storlet_engine/tasks/main.yml

126 lines
4.5 KiB
YAML

#---------------------------------------------------------------------------
# Copyright IBM Corp. 2015, 2015 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.
#---------------------------------------------------------------------------
- name: copy python facade tar locally
copy: src={{ SBusPythonFacade_dir }}/dist/{{ SBusPythonFacade_egg_dist }} dest=/tmp
- name: test SBusPythonFacade state
stat: path="/{{python_dist_packages_dir}}/SBusPythonFacade"
register: st
- name: remove python facade if exists
file: path="/{{python_dist_packages_dir}}/SBusPythonFacade" state=absent
when: st.stat.exists
- name: test SBusPythonFacade egg state
stat: path="/{{python_dist_packages_dir}}/sbus-1.0-py2.7.egg-info"
register: st
- name: remove python facade egg if exists
file: path="/{{python_dist_packages_dir}}/sbus-1.0-py2.7.egg-info" state=absent
when: st.stat.exists
- name: unarchive python facade
unarchive: owner=root group=root mode=0755 dest=/ src=/tmp/{{ SBusPythonFacade_egg_dist }}
- name: delete python facade tar local copy
file: path=/tmp/{{ SBusPythonFacade_egg_dist }} state=absent
- name: install sbus transport layer on host
copy: src={{ SBusTransportLayer_dir }}/{{ sbus_so }} dest=/{{python_dist_packages_dir}} owner=root group=root mode=0755
- name: copy swift middleware tar locally
copy: src={{ swift_middleware_dir }}/dist/{{ swift_middleware_egg_dist }} dest=/tmp
- name: test swift_middleware state
stat: path="/{{python_dist_packages_dir}}/storlet_middleware"
register: st
- name: remove storlet_middleware if exists
file: path="/{{python_dist_packages_dir}}/storlet_middleware" state=absent
when: st.stat.exists
- name: test storlet_gateway state
stat: path="/{{python_dist_packages_dir}}/storlet_gateway"
register: st
- name: remove storlet_gateway if exists
file: path="/{{python_dist_packages_dir}}/storlet_gateway" state=absent
when: st.stat.exists
- name: test storlets egg state
stat: path="/{{python_dist_packages_dir}}/storlets-1.0-py2.7.egg-info"
register: st
- name: remove storlets egg if exists
file: path="/{{python_dist_packages_dir}}/storlets-1.0-py2.7.egg-info" state=absent
when: st.stat.exists
- name: unarchive swift middleware
unarchive: owner=root group=root mode=0755 dest=/ src=/tmp/{{ swift_middleware_egg_dist }}
- name: delete swift middleware tar local copy
file: path=/tmp/{{ swift_middleware_egg_dist }} state=absent
- stat: path={{ docker_device }}/scripts
register: st
- name: Create scripts directory
file: path="{{ docker_device }}/scripts/" state=directory owner="{{ swift_run_time_user }}" group="{{ swift_run_time_group }}" mode=0755
when: not st.stat.exists
- name: install runtime scripts used by swift middleware
copy:
src: "{{ storlet_source_dir }}/{{ item }}"
dest: "{{ docker_device }}/scripts/"
mode: "04755"
owner: root
group: root
with_items:
- "Engine/SMScripts/bin/restart_docker_container"
- "Engine/SMScripts/send_halt_cmd_to_daemon_factory.py"
- name: create installation directory
file: path={{ engine_install_dir }} state=directory recurse=yes
- name: Copy Swift middleware conf template
template:
src: ../../common_templates/swift_middleware_conf
dest: "{{ engine_install_dir }}"
owner: "{{ swift_run_time_user }}"
group: "{{ swift_run_time_group }}"
mode: "0644"
- name: Copy install script
copy:
src: "{{ item }}"
dest: "{{ engine_install_dir }}"
with_items:
- ../../common_files/swift_config.py
- name: Copy gateway conf template
template:
src: ../../common_templates/storlet-docker-gateway.conf-sample
dest: "{{ storlet_gateway_conf_file }}"
owner: "{{ swift_run_time_user }}"
group: "{{ swift_run_time_group }}"
mode: 0644
- name: configure swift
shell: chdir={{ engine_install_dir }}
python swift_config.py install swift_middleware_conf "{{ swift_run_time_user }}"
- name: restart swift
shell: swift-init --run-dir="{{swift_run_time_dir}}" all restart
ignore_errors: yes