Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 1 | --- |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (C) 2019 The Nordix Foundation. All rights reserved. |
| 4 | # ================================================================================ |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | # SPDX-License-Identifier: Apache-2.0 |
| 18 | # ============LICENSE_END========================================================= |
| 19 | |
| 20 | - name: Remove existing files and directories |
| 21 | file: |
| 22 | path: "{{ engine_cache }}/repos/kubespray" |
| 23 | state: absent |
| 24 | |
| 25 | - name: Clone kubespray repository and checkout '{{ kubespray_version }}' |
| 26 | git: |
| 27 | repo: "{{ kubespray_git_url }}" |
| 28 | dest: "{{ engine_cache }}/repos/kubespray" |
| 29 | version: "{{ kubespray_version }}" |
| 30 | force: yes |
| 31 | environment: |
| 32 | http_proxy: "{{ lookup('env','http_proxy') }}" |
| 33 | https_proxy: "{{ lookup('env','https_proxy') }}" |
| 34 | no_proxy: "{{ lookup('env','no_proxy') }}" |
| 35 | |
| 36 | # TODO: some stuff below could and perhaps should be pushed into the scenario |
| 37 | # it is put here to make basic installation work without complexities |
| 38 | - name: Put initial structure in place |
| 39 | synchronize: |
| 40 | src: "{{ engine_cache }}/repos/kubespray/inventory/sample/" |
| 41 | dest: "{{ engine_cache }}/repos/kubespray/inventory/engine" |
| 42 | recursive: yes |
| 43 | delete: yes |
| 44 | |
Wenqing Gu | 3d80221 | 2019-04-18 08:28:24 +0200 | [diff] [blame] | 45 | # update ControlPersist to 60m to inline with max time |
| 46 | - name: Update ControlPersist in ansible config |
| 47 | lineinfile: |
| 48 | path: "{{ engine_cache }}/repos/kubespray/ansible.cfg" |
| 49 | regexp: "^ssh_args.*" |
| 50 | line: "ssh_args = -o ControlMaster=auto -o ControlPersist=60m -o ConnectionAttempts=100 -o UserKnownHostsFile=/dev/null" |
| 51 | |
Fatih Degirmenci | 51a4f88 | 2019-03-19 17:35:15 +0000 | [diff] [blame] | 52 | # enable helm for all the scenarios using kubespray |
| 53 | - name: Enable helm |
| 54 | lineinfile: |
| 55 | path: "{{ engine_cache }}/repos/kubespray/inventory/engine/group_vars/k8s-cluster/addons.yml" |
| 56 | regexp: "^helm_enabled:.*" |
| 57 | line: "helm_enabled: true" |
| 58 | |
Fatih Degirmenci | 4187370 | 2019-04-08 22:24:18 +0000 | [diff] [blame] | 59 | # enable creation of kubeconfig on localhost for all the scenarios using kubespray |
| 60 | - name: Enable creation of kubeconfig on localhost |
| 61 | lineinfile: |
| 62 | path: "{{ engine_cache }}/repos/kubespray/inventory/engine/group_vars/k8s-cluster/k8s-cluster.yml" |
| 63 | regexp: "^# kubeconfig_localhost:.*" |
| 64 | line: "kubeconfig_localhost: true" |
| 65 | |
Fatih Degirmenci | 40387d2 | 2019-05-21 11:36:10 +0200 | [diff] [blame] | 66 | # set k8s version to install |
| 67 | - name: Set k8s version to '{{ kubernetes_version }}' |
| 68 | lineinfile: |
| 69 | path: "{{ engine_cache }}/repos/kubespray/inventory/engine/group_vars/k8s-cluster/k8s-cluster.yml" |
| 70 | regexp: "^kube_version:.*" |
| 71 | line: "kube_version: {{ kubernetes_version }}" |
| 72 | |
Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 73 | # TODO: reuse of bifrost dynamic inventory is only valid for the cases that use |
| 74 | # bifrost for provisioning so this needs fixing and we could perhaps switch to |
| 75 | # our own inventory, dynamic or static. |
| 76 | - name: Place bifrost_inventory.py in Kubespray inventory |
| 77 | file: |
| 78 | src: "{{ engine_cache }}/repos/bifrost/playbooks/inventory/bifrost_inventory.py" |
| 79 | dest: "{{ engine_cache }}/repos/kubespray/inventory/engine/bifrost_inventory.py" |
| 80 | state: link |
| 81 | |
Fatih Degirmenci | f2b36ac | 2019-04-01 23:28:50 +0000 | [diff] [blame] | 82 | # configure docker with iptables |
| 83 | - name: Ensure docker daemon iptables option is set to true |
| 84 | lineinfile: |
| 85 | path: "{{ engine_cache }}/repos/kubespray/inventory/engine/group_vars/all/docker.yml" |
| 86 | regexp: "^docker_iptables_enabled:.*" |
| 87 | line: "docker_iptables_enabled: true" |
| 88 | |
Fatih Degirmenci | ccc6889 | 2019-02-27 09:16:45 +0000 | [diff] [blame] | 89 | # vim: set ts=2 sw=2 expandtab: |