blob: ec54b029b0b376bef806765795ce44dee6c20093 [file] [log] [blame]
Luca Pretec97ad882018-05-04 11:22:14 -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
17- hosts: localhost
Luca Pretec97ad882018-05-04 11:22:14 -070018 vars:
Zack Williams249ac7f2018-05-18 13:34:14 -070019 kubespray_remote_ssh_user: "cord"
Luca Pretec97ad882018-05-04 11:22:14 -070020
21 tasks:
Zack Williamsbb846a22018-06-26 14:57:17 -070022
Luca Pretec97ad882018-05-04 11:22:14 -070023 # Edit all.yml variable file
Zack Williamsbb846a22018-06-26 14:57:17 -070024 - name: Add lines to the all.yaml variable file
Luca Pretec97ad882018-05-04 11:22:14 -070025 lineinfile:
Luca Prete84fe2a12019-01-06 11:56:20 -080026 path: inventories/{{ deployment_name }}/group_vars/all/all.yml
Zack Williamsbb846a22018-06-26 14:57:17 -070027 line: "{{ item }}"
28 with_items:
29 - 'ansible_python_interpreter: /usr/bin/python2.7'
30 - 'ansible_user: {{ kubespray_remote_ssh_user }}'
31 - 'ansible_become: true'
Zack Williamsd24053d2018-07-31 09:12:35 -070032 - 'kube_feature_gates: []'
Luca Prete84fe2a12019-01-06 11:56:20 -080033 - 'kube_network_plugin: calico'
34 - 'kube_network_plugin_multus: true'
Luca Pretec97ad882018-05-04 11:22:14 -070035
36 # Edit k8s-cluster.yml variable file
37 - name: Set Docker DNS servers strict to false
38 lineinfile:
Luca Prete84fe2a12019-01-06 11:56:20 -080039 path: inventories/{{ deployment_name }}/group_vars/k8s-cluster/k8s-cluster.yml
Luca Pretec97ad882018-05-04 11:22:14 -070040 regexp: '^#\s*docker_dns_servers_strict.*$'
41 line: 'docker_dns_servers_strict: false'
42
43 - name: Set Helm enabled to true
44 lineinfile:
Luca Prete84fe2a12019-01-06 11:56:20 -080045 path: inventories/{{ deployment_name }}/group_vars/k8s-cluster/k8s-cluster.yml
Luca Pretec97ad882018-05-04 11:22:14 -070046 regexp: '^helm_enabled.*$'
47 line: 'helm_enabled: true'
48
49 - name: Set kubeconfig localhost to true
50 lineinfile:
Luca Prete84fe2a12019-01-06 11:56:20 -080051 path: inventories/{{ deployment_name }}/group_vars/k8s-cluster/k8s-cluster.yml
Luca Pretec97ad882018-05-04 11:22:14 -070052 regexp: '^#\s*kubeconfig_localhost.*$'
53 line: 'kubeconfig_localhost: true'
54
55 - name: Allow insecure registry access
56 lineinfile:
Luca Prete84fe2a12019-01-06 11:56:20 -080057 path: inventories/{{ deployment_name }}/group_vars/k8s-cluster/k8s-cluster.yml
Luca Pretec97ad882018-05-04 11:22:14 -070058 regexp: 'docker_options'
59 line: "docker_options: \"{{ item }} --insecure-registry={{ '{{' }} kube_service_addresses {{ '}}' }} --graph={{ '{{' }} docker_daemon_graph {{ '}}' }} {{ '{{' }} docker_log_opts {{ '}}' }}\""
60 with_items: "{{ k8s_nodes.split(' ') | map('regex_replace', '(.*)', '--insecure-registry=\\1/32') | join(' ') }}"