
# Copyright 2017-present Open Networking Foundation
#
# 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.


---
# lxd-finish/tasks/main.yml

- name: Verify that we can log into every container
  command: >
    ansible containers -u ubuntu
     -m ping
  tags:
    - skip_ansible_lint # connectivity check

- name: Verify that containers have external connectivity
  command: >
    ansible containers -u ubuntu
     -m uri
     -a "url=http://opencord.org validate_certs=no"
  tags:
    - skip_ansible_lint # connectivity check

- name: Update CA certificates in containers
  command: >
    ansible containers -b -u ubuntu
      -m command
      -a "update-ca-certificates"
  tags:
    - skip_ansible_lint # running a sub job

- name: Have containers use the apt-cache
  when: use_apt_cache
  command: >
    ansible containers -b -u ubuntu
     -m lineinfile
     -a "dest=/etc/apt/apt.conf.d/02apt-cacher-ng create=yes mode=0644 owner=root group=root regexp='^Acquire' line='Acquire::http { Proxy \"http://{{ apt_cacher_name }}:{{ apt_cacher_port | default('3142') }}\"; };'"
  tags:
    - skip_ansible_lint # running a sub job

- name: Update apt cache
  command: >
    ansible containers -b -u ubuntu
      -m apt
      -a "update_cache=yes cache_valid_time=3600"
  tags:
    - skip_ansible_lint # running a sub job

- name: Update software in all the containers
  when: run_dist_upgrade
  command: >
    ansible containers -b -u ubuntu
      -m apt
      -a "upgrade=dist"
  tags:
    - skip_ansible_lint # running a sub job

