Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 1 | --- |
| 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 Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 18 | vars: |
Zack Williams | 249ac7f | 2018-05-18 13:34:14 -0700 | [diff] [blame] | 19 | kubespray_remote_ssh_user: "cord" |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 20 | |
| 21 | tasks: |
Zack Williams | bb846a2 | 2018-06-26 14:57:17 -0700 | [diff] [blame] | 22 | |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 23 | # Edit all.yml variable file |
Zack Williams | bb846a2 | 2018-06-26 14:57:17 -0700 | [diff] [blame] | 24 | - name: Add lines to the all.yaml variable file |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 25 | lineinfile: |
Luca Prete | 84fe2a1 | 2019-01-06 11:56:20 -0800 | [diff] [blame] | 26 | path: inventories/{{ deployment_name }}/group_vars/all/all.yml |
Zack Williams | bb846a2 | 2018-06-26 14:57:17 -0700 | [diff] [blame] | 27 | line: "{{ item }}" |
| 28 | with_items: |
| 29 | - 'ansible_python_interpreter: /usr/bin/python2.7' |
| 30 | - 'ansible_user: {{ kubespray_remote_ssh_user }}' |
| 31 | - 'ansible_become: true' |
Luca Prete | 736dad8 | 2019-02-13 11:39:42 -0800 | [diff] [blame] | 32 | - 'kube_feature_gates: [SCTPSupport=true]' |
Luca Prete | 84fe2a1 | 2019-01-06 11:56:20 -0800 | [diff] [blame] | 33 | - 'kube_network_plugin: calico' |
| 34 | - 'kube_network_plugin_multus: true' |
Luca Prete | 736dad8 | 2019-02-13 11:39:42 -0800 | [diff] [blame] | 35 | - 'calico_version: v3.4.0' |
| 36 | - 'calico_cni_version: v3.4.0' |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 37 | |
| 38 | # Edit k8s-cluster.yml variable file |
| 39 | - name: Set Docker DNS servers strict to false |
| 40 | lineinfile: |
Luca Prete | 84fe2a1 | 2019-01-06 11:56:20 -0800 | [diff] [blame] | 41 | path: inventories/{{ deployment_name }}/group_vars/k8s-cluster/k8s-cluster.yml |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 42 | regexp: '^#\s*docker_dns_servers_strict.*$' |
| 43 | line: 'docker_dns_servers_strict: false' |
| 44 | |
| 45 | - name: Set Helm enabled to true |
| 46 | lineinfile: |
Luca Prete | 84fe2a1 | 2019-01-06 11:56:20 -0800 | [diff] [blame] | 47 | path: inventories/{{ deployment_name }}/group_vars/k8s-cluster/k8s-cluster.yml |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 48 | regexp: '^helm_enabled.*$' |
| 49 | line: 'helm_enabled: true' |
| 50 | |
| 51 | - name: Set kubeconfig localhost to true |
| 52 | lineinfile: |
Luca Prete | 84fe2a1 | 2019-01-06 11:56:20 -0800 | [diff] [blame] | 53 | path: inventories/{{ deployment_name }}/group_vars/k8s-cluster/k8s-cluster.yml |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 54 | regexp: '^#\s*kubeconfig_localhost.*$' |
| 55 | line: 'kubeconfig_localhost: true' |
| 56 | |
| 57 | - name: Allow insecure registry access |
| 58 | lineinfile: |
Luca Prete | 84fe2a1 | 2019-01-06 11:56:20 -0800 | [diff] [blame] | 59 | path: inventories/{{ deployment_name }}/group_vars/k8s-cluster/k8s-cluster.yml |
Luca Prete | c97ad88 | 2018-05-04 11:22:14 -0700 | [diff] [blame] | 60 | regexp: 'docker_options' |
| 61 | line: "docker_options: \"{{ item }} --insecure-registry={{ '{{' }} kube_service_addresses {{ '}}' }} --graph={{ '{{' }} docker_daemon_graph {{ '}}' }} {{ '{{' }} docker_log_opts {{ '}}' }}\"" |
| 62 | with_items: "{{ k8s_nodes.split(' ') | map('regex_replace', '(.*)', '--insecure-registry=\\1/32') | join(' ') }}" |