Follow the general workflow of PIP

This commit is contained in:
Taseer Ahmed 2017-09-21 13:26:57 +05:00
parent 5afc4e6a2f
commit 69eb16d9ae
2 changed files with 67 additions and 43 deletions

View File

@ -14,8 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
congress_package_state: "latest"
congress_git_repo: https://git.openstack.org/openstack/congress
congress_git_install_branch: master
congress_developer_mode: false
congress_requirements_git_repo: https://git.openstack.org/openstack/requirements
congress_requirements_git_install_branch: master
congress_developer_mode: false

View File

@ -14,53 +14,74 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- debug:
msg: "This script will install Congress"
- name: clone requirements repository
git:
repo: "{{ congress_requirements_git_repo }}"
dest: /opt/requirements
clone: yes
update: yes
- name: create venv directory
file:
path: /openstack/venvs/congress/bin
state: directory
- name: install pip packages
- name: Install required pip packages
pip:
name: "{{ congress_requires_pip_packages }}"
state: present
virtualenv: "/openstack/venvs/congress/"
name: "{{ congress_requires_pip_packages | join(' ') }}"
state: "{{ congress_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
- name: get venv checksum
stat:
path: "/var/cache/{{ congress_venv_download_url | basename }}"
get_md5: False
register: local_venv_stat
- name: Retrieve checksum for venv download
uri:
url: "{{ congress_venv_download_url | replace('tgz', 'checksum') }}"
return_content: yes
register: congress_venv_checksum
when: not congress_developer_mode | bool
#- name: get remote venv checksum
# uri:
# url: "{{ congress_venv_download_url | replace('tgz', 'checksum')}}"
# return_content: True
- name: Attempt venv download
get_url:
url: "{{ congress_venv_download_url }}"
dest: "/var/cache/{{ congress_venv_download_url | basename }}"
checksum: "sha1:{{ congress_venv_checksum.content | trim }}"
register: congress_get_venv
when: not congress_developer_mode | bool
- name: clone congress repo
git:
repo: "{{ congress_git_repo }}"
dest: /opt/congress
clone: yes
- name: Remove existing venv
file:
path: "{{ congress_bin | dirname }}"
state: absent
when: congress_get_venv | changed
- name: install congress packages
shell: cd /opt/congress && pip install .
- name: Create congress venv dir
file:
path: "{{ congress_bin | dirname }}"
state: directory
register: congress_venv_dir
when: not congress_developer_mode | bool
#- name: attempt venv download
# get_url:
# url: "{{ congress_venv_download_url }}"
# dest: "/var/cache/{{ congress_venv_download_url | basename }}"
# ignore_errors: true
# register: tacker_get_venv
- name: Unarchive pre-built venv
unarchive:
src: "/var/cache/{{ congress_venv_download_url | basename }}"
dest: "{{ congress_bin | dirname }}"
copy: "no"
when:
- not congress_developer_mode | bool
- congress_get_venv | changed or congress_venv_dir | changed
- name: generating the configuration
shell: tox -egenconfig
- name: Install pip packages
pip:
name: "{{ congress_pip_packages | join(' ') }}"
state: "{{ congress_package_state }}"
virtualenv: "{{ congress_bin | dirname }}"
virtualenv_site_packages: "no"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
when: congress_developer_mode | bool
- name: Update virtualenv path
command: >
virtualenv-tools --update-path=auto --reinitialize {{ congress_bin | dirname }}
when:
- not congress_developer_mode | bool
- congress_get_venv | changed or congress_venv_dir | changed
- name: Record the venv tag deployed
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: congress
option: venv_tag
value: "{{ congress_venv_tag }}"