Only install to virtual environment
The role had no previous support for installation in a virtualenv Change-Id: I176f811e5ec7e0705037f53997f28bdbed40f0d9 Implements: blueprint only-install-venvs
This commit is contained in:
parent
efbe6f7b20
commit
d4f029bf31
|
@ -1,5 +1,9 @@
|
|||
Vagrant.configure(2) do |config|
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.provider "virtualbox" do |v|
|
||||
v.memory = 2048
|
||||
v.cpus = 2
|
||||
end
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
sudo su -
|
||||
cd /vagrant
|
||||
|
|
|
@ -63,6 +63,12 @@ barbican_developer_mode: false
|
|||
barbican_developer_constraints:
|
||||
- "git+{{ barbican_git_repo }}@{{ barbican_git_install_branch }}#egg=barbican"
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
barbican_venv_tag: untagged
|
||||
barbican_bin: "/openstack/venvs/barbican-{{ barbican_venv_tag }}/bin"
|
||||
|
||||
barbican_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/barbican.tgz
|
||||
|
||||
# Database vars
|
||||
barbican_galera_database: barbican
|
||||
barbican_galera_user: barbican
|
||||
|
@ -103,6 +109,11 @@ barbican_ssl_self_signed_subject: "/C=US/ST=Texas/L=San Antonio/O=IT/CN={{ inter
|
|||
#barbican_user_ssl_key: <path to cert on ansible deployment host>
|
||||
#barbican_user_ssl_ca_cert: <path to cert on ansible deployment host>
|
||||
|
||||
barbican_requires_pip_packages:
|
||||
- virtualenv
|
||||
- virtualenv-tools
|
||||
- python-keystoneclient # Keystoneclient needed by OSA keystone lib
|
||||
|
||||
barbican_pip_packages:
|
||||
- alembic
|
||||
- Babel
|
||||
|
|
|
@ -22,3 +22,8 @@
|
|||
until: apache_restart|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Restart barbican services
|
||||
service:
|
||||
name: "{{ barbican_uwsgi_program_name }}"
|
||||
state: "restarted"
|
|
@ -19,7 +19,7 @@ FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
|
|||
|
||||
# prep the host
|
||||
if [ "$(which apt-get)" ]; then
|
||||
apt-get install -y build-essential python2.7 python-dev git-core
|
||||
apt-get install -y build-essential python2.7 python-dev git-core libssl-dev
|
||||
fi
|
||||
|
||||
# get pip, if necessary
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
# limitations under the License.
|
||||
|
||||
- name: Perform a synchronization of the Barbican database
|
||||
command: "barbican-db-manage upgrade"
|
||||
command: "{{ barbican_bin }}/barbican-db-manage upgrade"
|
||||
become: yes
|
||||
become_user: "{{ barbican_system_user_name }}"
|
||||
|
|
|
@ -49,13 +49,98 @@
|
|||
when:
|
||||
- not barbican_developer_mode | bool
|
||||
|
||||
- name: Install pip packages for Barbican
|
||||
- name: Install requires pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: "latest"
|
||||
state: latest
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_barbican_pip_packages
|
||||
until: install_barbican_pip_packages |success
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ barbican_requires_pip_packages }}"
|
||||
|
||||
- name: Get local venv checksum
|
||||
stat:
|
||||
path: "/var/cache/{{ barbican_venv_download_url | basename }}"
|
||||
get_md5: False
|
||||
when:
|
||||
- not barbican_developer_mode | bool
|
||||
register: local_venv_stat
|
||||
|
||||
- name: Get remote venv checksum
|
||||
uri:
|
||||
url: "{{ barbican_venv_download_url | replace('tgz', 'checksum') }}"
|
||||
return_content: True
|
||||
when:
|
||||
- not barbican_developer_mode | bool
|
||||
register: remote_venv_checksum
|
||||
|
||||
# TODO: When project moves to ansible 2 we can pass this a sha256sum which will:
|
||||
# a) allow us to remove force: yes
|
||||
# b) allow the module to calculate the checksum of dest file which would
|
||||
# result in file being downloaded only if provided and dest sha256sum
|
||||
# checksums differ
|
||||
- name: Attempt venv download
|
||||
get_url:
|
||||
url: "{{ barbican_venv_download_url }}"
|
||||
dest: "/var/cache/{{ barbican_venv_download_url | basename }}"
|
||||
force: yes
|
||||
ignore_errors: true
|
||||
register: get_venv
|
||||
when:
|
||||
- not barbican_developer_mode | bool
|
||||
- (local_venv_stat.stat.exists == False or
|
||||
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
|
||||
|
||||
- name: Set barbican get_venv fact
|
||||
set_fact:
|
||||
barbican_get_venv: "{{ get_venv }}"
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ barbican_bin | dirname }}"
|
||||
state: absent
|
||||
when:
|
||||
- barbican_get_venv | changed
|
||||
|
||||
- name: Create barbican venv dir
|
||||
file:
|
||||
path: "{{ barbican_bin | dirname }}"
|
||||
state: directory
|
||||
register: barbican_venv_dir
|
||||
when:
|
||||
- not barbican_developer_mode | bool
|
||||
|
||||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ barbican_venv_download_url | basename }}"
|
||||
dest: "{{ barbican_bin | dirname }}"
|
||||
copy: "no"
|
||||
when:
|
||||
- not barbican_developer_mode | bool
|
||||
- barbican_get_venv | changed or barbican_venv_dir | changed
|
||||
notify: Restart barbican services
|
||||
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ barbican_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ barbican_pip_packages }}"
|
||||
when:
|
||||
- barbican_get_venv | failed or barbican_developer_mode | bool
|
||||
notify: Restart barbican services
|
||||
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ barbican_bin | dirname }}
|
||||
when:
|
||||
- not barbican_developer_mode | bool
|
||||
- barbican_get_venv | success
|
||||
|
|
|
@ -56,10 +56,5 @@
|
|||
tags:
|
||||
- barbican-install
|
||||
|
||||
- name: Restart Barbican Services
|
||||
service:
|
||||
name: "{{ barbican_uwsgi_program_name }}"
|
||||
state: "restarted"
|
||||
|
||||
- name: Flush handlers
|
||||
meta: flush_handlers
|
||||
|
|
|
@ -12,7 +12,7 @@ respawn
|
|||
respawn limit 10 5
|
||||
|
||||
# Set the RUNBIN environment variable
|
||||
env RUNBIN="/usr/local/bin/{{ program_name }}"
|
||||
env RUNBIN="{{ barbican_bin }}/{{ program_name }}"
|
||||
|
||||
# Change directory to service users home
|
||||
chdir "{{ service_home }}"
|
||||
|
|
Loading…
Reference in New Issue