Oleksandr Kozachenko | b009349 | 2023-09-06 21:43:47 +0200 | [diff] [blame] | 1 | # Copyright (c) 2023 VEXXHOST, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | - ansible.builtin.import_playbook: vexxhost.atmosphere.kubernetes |
| 16 | |
| 17 | # NOTE(mnaser): When using Docker with custom networks, it will use 127.0.0.11 |
| 18 | # as the DNS server which trips up the CoreDNS "loop" plugin. |
| 19 | - name: Switch CoreDNS to use CloudFlare DNS |
| 20 | hosts: controllers[0] |
| 21 | become: true |
| 22 | tasks: |
| 23 | - name: Update CoreDNS ConfigMap |
| 24 | kubernetes.core.k8s: |
| 25 | state: present |
| 26 | definition: |
| 27 | apiVersion: v1 |
| 28 | kind: ConfigMap |
| 29 | metadata: |
| 30 | name: coredns |
| 31 | namespace: kube-system |
| 32 | data: |
| 33 | Corefile: | |
| 34 | .:53 { |
| 35 | errors |
| 36 | health { |
| 37 | lameduck 5s |
| 38 | } |
| 39 | ready |
| 40 | kubernetes cluster.local in-addr.arpa ip6.arpa { |
| 41 | pods insecure |
| 42 | fallthrough in-addr.arpa ip6.arpa |
| 43 | ttl 30 |
| 44 | } |
| 45 | prometheus :9153 |
| 46 | forward . 1.1.1.1 { |
| 47 | max_concurrent 1000 |
| 48 | } |
| 49 | cache 30 |
| 50 | loop |
| 51 | reload |
| 52 | loadbalance |
| 53 | } |
| 54 | notify: |
| 55 | - Rollout CoreDNS |
| 56 | - Wait for CoreDNS to be ready |
| 57 | handlers: |
| 58 | - name: Rollout CoreDNS |
| 59 | command: kubectl -n kube-system rollout restart deploy/coredns |
| 60 | - name: Wait for CoreDNS to be ready |
| 61 | command: kubectl -n kube-system rollout status deploy/coredns |
| 62 | |
| 63 | - ansible.builtin.import_playbook: vexxhost.atmosphere.csi |
| 64 | |
| 65 | - hosts: controllers |
| 66 | become: true |
| 67 | roles: |
| 68 | - vexxhost.atmosphere.ingress_nginx |