blob: b998a06116dff42f6e274c31d121a9bab6c66545 [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:
22 # Edit all.yml variable file
23
24 - name: Add default Python interpreter
25 lineinfile:
26 path: inventories/{{ deployment_name }}/group_vars/all.yml
27 line: 'ansible_python_interpreter: /usr/bin/python2.7'
28
29 - name: Add default Ansible user
30 lineinfile:
31 path: inventories/{{ deployment_name }}/group_vars/all.yml
Zack Williams249ac7f2018-05-18 13:34:14 -070032 line: 'ansible_user: {{ kubespray_remote_ssh_user }}'
Luca Pretec97ad882018-05-04 11:22:14 -070033
34 - name: Give sudoer permissions
35 lineinfile:
36 path: inventories/{{ deployment_name }}/group_vars/all.yml
37 line: 'ansible_become: true'
38
39 # Edit k8s-cluster.yml variable file
40 - name: Set Docker DNS servers strict to false
41 lineinfile:
42 path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml
43 regexp: '^#\s*docker_dns_servers_strict.*$'
44 line: 'docker_dns_servers_strict: false'
45
46 - name: Set Helm enabled to true
47 lineinfile:
48 path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml
49 regexp: '^helm_enabled.*$'
50 line: 'helm_enabled: true'
51
52 - name: Set kubeconfig localhost to true
53 lineinfile:
54 path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml
55 regexp: '^#\s*kubeconfig_localhost.*$'
56 line: 'kubeconfig_localhost: true'
57
58 - name: Allow insecure registry access
59 lineinfile:
60 path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml
61 regexp: 'docker_options'
62 line: "docker_options: \"{{ item }} --insecure-registry={{ '{{' }} kube_service_addresses {{ '}}' }} --graph={{ '{{' }} docker_daemon_graph {{ '}}' }} {{ '{{' }} docker_log_opts {{ '}}' }}\""
63 with_items: "{{ k8s_nodes.split(' ') | map('regex_replace', '(.*)', '--insecure-registry=\\1/32') | join(' ') }}"