summaryrefslogtreecommitdiffstats
path: root/xci/installer/osa/playbooks/post-deployment.yml
blob: 9f2fec3823429fca1208562a0acaaa21941991ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2018 Ericsson AB and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
- hosts: opnfv
  remote_user: root
  vars_files:
    - "{{ xci_path }}/xci/var/opnfv.yml"
    - "{{ xci_path }}/xci/installer/osa/files/openstack_services.yml"

  environment:
    http_proxy: "{{ lookup('env','http_proxy') }}"
    https_proxy: "{{ lookup('env','https_proxy') }}"
    no_proxy: "{{ lookup('env','no_proxy') }}"
    HTTP_PROXY: "{{ lookup('env','http_proxy') }}"
    HTTPS_PROXY: "{{ lookup('env','https_proxy') }}"
    NO_PROXY: "{{ lookup('env','no_proxy') }}"
  pre_tasks:
    - name: Load distribution variables
      include_vars:
        file: "{{ item }}"
      with_items:
        - "{{ xci_path }}/xci/var/{{ ansible_os_family }}.yml"
    - name: Set facts for remote deployment
      set_fact:
        remote_xci_scenario_path: "{{ ansible_env.HOME }}/releng-xci/.cache/repos/scenarios/{{ deploy_scenario }}/scenarios/{{ deploy_scenario }}"

  roles:
    - role: ruzickap.proxy_settings
      proxy_settings_http_proxy: "{{ lookup('env','http_proxy') }}"
      proxy_settings_https_proxy: "{{ lookup('env','https_proxy') }}"
      proxy_settings_ftp_proxy: "{{ lookup('env','ftp_proxy') }}"
      proxy_settings_no_proxy: "{{ lookup('env','no_proxy') }}"

  tasks:
    - name: "Configure http_proxy_env_url"
      lineinfile:
        path: "{{openstack_osa_etc_path}}/user_variables_proxy.yml"
        regexp: "^http_proxy_env_url:.*"
        line: "{{ 'http_proxy_env_url: ' + lookup('env','http_proxy') }}"
      when:
        - lookup('env','http_proxy') != ""

    - name: Reload XCI deployment host facts
      setup:
        filter: ansible_local
        gather_subset: "!all"
      delegate_to: 127.0.0.1

    - name: Check if any post-deployment task defined for {{ deploy_scenario }} role
      stat:
        path: "{{ remote_xci_scenario_path }}/role/{{ deploy_scenario }}/tasks/post-deployment.yml"
      register: post_deployment_yml

    - name: Execute post-deployment tasks of {{ deploy_scenario }} role
      include_role:
        name: "{{ hostvars['opnfv'].ansible_local.xci.scenarios.role }}"
        tasks_from: post-deployment
      when:
        - post_deployment_yml.stat.exists