--- # Copyright 2014, Rackspace US, Inc. # # 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. #TODO(evrardjp): Replace the next 2 tasks by a standard apt with cache #when https://github.com/ansible/ansible-modules-core/pull/1517 is merged #in 1.9.x or we move to 2.0 (if tested working) - name: Check apt last update file stat: path: /var/cache/apt register: apt_cache_stat tags: - horizon-apt-packages - name: Update apt if needed apt: update_cache: yes when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" tags: - horizon-apt-packages - name: Create developer mode constraint file copy: dest: "/opt/developer-pip-constraints.txt" content: | {% for item in horizon_developer_constraints %} {{ item }} {% endfor %} when: - horizon_developer_mode | bool tags: - horizon-install - horizon-pip-packages - name: Set constraint file fact for developer mode set_fact: pip_install_options: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt" when: - horizon_developer_mode | bool tags: - horizon-install - horizon-pip-packages - name: Install apt packages apt: pkg: "{{ item }}" state: latest register: install_packages until: install_packages|success retries: 5 delay: 2 with_items: horizon_apt_packages tags: - horizon-install - horizon-apt-packages - name: Install pip packages (venv) pip: name: "{{ item }}" state: present virtualenv: "{{ horizon_venv_bin | dirname }}" virtualenv_site_packages: "no" extra_args: "{{ pip_install_options|default('') }}" register: install_packages until: install_packages|success retries: 5 delay: 2 with_items: horizon_pip_packages when: - horizon_venv_enabled | bool - horizon_get_venv | failed or horizon_developer_mode | bool notify: Restart apache2 tags: - horizon-pip-packages - name: Install pip packages (no venv) pip: name: "{{ item }}" state: present extra_args: "{{ pip_install_options|default('') }}" register: install_packages until: install_packages|success retries: 5 delay: 2 with_items: horizon_pip_packages when: - not horizon_developer_mode | bool - not horizon_venv_enabled | bool notify: Restart apache2 tags: - horizon-pip-packages