| --- |
| # Copyright 2017-present Open Networking Foundation |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| - hosts: localhost |
| vars: |
| kubespray_remote_ssh_user: "cord" |
| |
| tasks: |
| # Edit all.yml variable file |
| |
| - name: Add default Python interpreter |
| lineinfile: |
| path: inventories/{{ deployment_name }}/group_vars/all.yml |
| line: 'ansible_python_interpreter: /usr/bin/python2.7' |
| |
| - name: Add default Ansible user |
| lineinfile: |
| path: inventories/{{ deployment_name }}/group_vars/all.yml |
| line: 'ansible_user: {{ kubespray_remote_ssh_user }}' |
| |
| - name: Give sudoer permissions |
| lineinfile: |
| path: inventories/{{ deployment_name }}/group_vars/all.yml |
| line: 'ansible_become: true' |
| |
| # Edit k8s-cluster.yml variable file |
| - name: Set Docker DNS servers strict to false |
| lineinfile: |
| path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml |
| regexp: '^#\s*docker_dns_servers_strict.*$' |
| line: 'docker_dns_servers_strict: false' |
| |
| - name: Set Helm enabled to true |
| lineinfile: |
| path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml |
| regexp: '^helm_enabled.*$' |
| line: 'helm_enabled: true' |
| |
| - name: Set kubeconfig localhost to true |
| lineinfile: |
| path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml |
| regexp: '^#\s*kubeconfig_localhost.*$' |
| line: 'kubeconfig_localhost: true' |
| |
| - name: Allow insecure registry access |
| lineinfile: |
| path: inventories/{{ deployment_name }}/group_vars/k8s-cluster.yml |
| regexp: 'docker_options' |
| line: "docker_options: \"{{ item }} --insecure-registry={{ '{{' }} kube_service_addresses {{ '}}' }} --graph={{ '{{' }} docker_daemon_graph {{ '}}' }} {{ '{{' }} docker_log_opts {{ '}}' }}\"" |
| with_items: "{{ k8s_nodes.split(' ') | map('regex_replace', '(.*)', '--insecure-registry=\\1/32') | join(' ') }}" |