blob: c48dbbce2f1b01c28f6f9f0d7b779aff95943d74 [file] [log] [blame]
Zack Williams9f42b972018-01-10 15:05:35 -07001---
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# finish-kubespray/tasks/main.yml
17
18- name: Create ~/.kube directory
19 file:
20 state: directory
21 dest: "~/.kube"
22
23- name: Move kubespray admin.conf to ~/.kube/config
24 copy:
25 remote_src: true
Zack Williamsa7424092018-04-17 10:34:53 -070026 src: "{{ kubespray_dir }}/inventory/cord/artifacts/admin.conf"
Zack Williams9f42b972018-01-10 15:05:35 -070027 dest: "~/.kube/config"
28
29- name: Find Vagrant head VM IP address
30 shell: "vagrant ssh-config | grep -m 1 HostName | awk '{print $2}'"
31 args:
32 chdir: "{{ config_cord_dir }}/build"
33 environment:
34 VAGRANT_CWD: "{{ config_cord_dir }}/build/scenarios/{{ cord_scenario }}"
35 register: vagrant_head_vm_ip
36 tags:
37 - skip_ansible_lint # there isn't a module for this, info retrieval
38
39- name: Fix config URL to match Vagrant head VM IP
40 lineinfile:
41 path: "~/.kube/config"
42 regexp: "^ server: https://{{ management_net_cidr | ipaddr(1) | ipaddr('address') }}:6443"
43 line: " server: https://{{ vagrant_head_vm_ip.stdout }}:6443"
44