# Copyright 2022 Google LLC
#
# 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: Install dependencies for spack installation
  hosts: localhost
  tasks:
  - name: Install pip3 and git
    package:
      name:
      - python3-pip
      - git
  - name: Install google cloud storage
    pip:
      name: google-cloud-storage
      executable: pip3

# Copyright 2022 Google LLC
#
# 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: Install dependencies for spack installation
  become: yes
  hosts: localhost
  tasks:
  - name: Install pip3 and git
    ansible.builtin.package:
      name:
      - python3-pip
      - git
  - name: Gather the package facts
    ansible.builtin.package_facts:
      manager: auto
  - name: Install protobuf for old releases of Python
    when: ansible_facts.packages["python3"][0].version is version("3.7", "<") and ansible_facts.packages["python3"][0].version is version("3.5", ">=")
    ansible.builtin.pip:
      name: protobuf
      version: 3.19.4
      executable: pip3
  - name: Install google cloud storage
    ansible.builtin.pip:
      name: google-cloud-storage
      executable: pip3

Install compatible protobuf for older Python
Install compatible protobuf for older Python

The protobuf library is heavily used by other Google Cloud libraries.
We can use the Ansible fact for the Python 3 package version to ensure
that we are installing a compatible release of protobuf on systems
with out-of-date Python (e.g. CentOS 7 and the "HPC VM Image").

Resolves #368
