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