blob: 383f55fc9fac882c9f67f5b9759522c5e3ce8b2d (
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
|
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2019 Ericsson Software Technology 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: localhost
connection: local
vars_files:
- "{{ xci_path }}/xci/var/opnfv.yml"
tasks:
- name: delete existing kubespray/inventory/opnfv directory
file:
path: "{{ xci_path }}/.cache/repos/kubespray/inventory/opnfv"
state: absent
- name: copy kubespray/inventory/sample as kubespray/inventory/opnfv
copy:
src: "{{ xci_path }}/.cache/repos/kubespray/inventory/sample/"
dest: "{{ xci_path }}/.cache/repos/kubespray/inventory/opnfv"
- name: update kubespray k8s-cluster.yml for xci
lineinfile:
path: "{{ xci_path }}/.cache/repos/kubespray/inventory/opnfv/group_vars/k8s-cluster/k8s-cluster.yml"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: "kube_version:.*", line: "kube_version: {{ kubernetes_version }}" }
- { regexp: "kubeconfig_localhost:.*", line: "kubeconfig_localhost: true" }
- { regexp: "kube_basic_auth:.*", line: "kube_basic_auth: true" }
- { regexp: "dashboard_enabled:.*", line: "dashboard_enabled: true" }
# NOTE(fdegir): the reason for this task to be separate from the task which uses lineinfile
# module is that escaping curly braces does not work with with_items. what happens is that
# ansible tries to resolve {{ ansible_env.HOME }} which we don't want since it should point
# to home folder of the user executing this task at runtime.
- name: update kubespray artifacts_dir
lineinfile:
path: "{{ xci_path }}/.cache/repos/kubespray/inventory/opnfv/group_vars/k8s-cluster/k8s-cluster.yml"
regexp: "artifacts_dir:.*"
line: "artifacts_dir: '{{ '{{' }} ansible_env.HOME {{ '}}' }}'"
- name: change dashboard server type to NodePort
lineinfile:
path: "{{ xci_path }}/.cache/repos/kubespray/roles/kubernetes-apps/ansible/templates/dashboard.yml.j2"
insertafter: 'targetPort'
line: " type: NodePort"
|