From e9870b8d259c4f31bdd16a15c9ced8acb3ea348f Mon Sep 17 00:00:00 2001 From: Cristian Calin <6627509+cristicalin@users.noreply.github.com> Date: Tue, 18 May 2021 15:39:31 +0300 Subject: [PATCH] add support for using ansible 2.10.x for deploying kubespray (#7600) * add support for using ansible 2.10.x for deploying kubespray * move dns-autoscaler-clusterrole{binding}.yml to files/ folder * note that ansible 2.10 is now experimentally supported * coredns: move files to templates like before #4341 --- README.md | 2 +- ansible_version.yml | 2 +- .../kubernetes-apps/ansible/tasks/coredns.yml | 29 +++++++++---------- .../coredns-clusterrole.yml.j2} | 0 .../coredns-clusterrolebinding.yml.j2} | 0 .../coredns-sa.yml.j2} | 0 .../dns-autoscaler-clusterrole.yml.j2} | 0 .../dns-autoscaler-clusterrolebinding.yml.j2} | 0 .../dns-autoscaler-sa.yml.j2} | 0 9 files changed, 16 insertions(+), 17 deletions(-) rename roles/kubernetes-apps/ansible/{files/coredns-clusterrole.yml => templates/coredns-clusterrole.yml.j2} (100%) rename roles/kubernetes-apps/ansible/{files/coredns-clusterrolebinding.yml => templates/coredns-clusterrolebinding.yml.j2} (100%) rename roles/kubernetes-apps/ansible/{files/coredns-sa.yml => templates/coredns-sa.yml.j2} (100%) rename roles/kubernetes-apps/ansible/{dns-autoscaler-clusterrole.yml => templates/dns-autoscaler-clusterrole.yml.j2} (100%) rename roles/kubernetes-apps/ansible/{dns-autoscaler-clusterrolebinding.yml => templates/dns-autoscaler-clusterrolebinding.yml.j2} (100%) rename roles/kubernetes-apps/ansible/{files/dns-autoscaler-sa.yml => templates/dns-autoscaler-sa.yml.j2} (100%) diff --git a/README.md b/README.md index 7bfc6b1b1..1ed532ab8 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ Note: Upstart/SysV init based OS types are not supported. ## Requirements - **Minimum required version of Kubernetes is v1.19** -- **Ansible v2.9.x, Jinja 2.11+ and python-netaddr is installed on the machine that will run Ansible commands, Ansible 2.10.x is not supported for now** +- **Ansible v2.9.x, Jinja 2.11+ and python-netaddr is installed on the machine that will run Ansible commands, Ansible 2.10.x is experimentally supported for now** - The target servers must have **access to the Internet** in order to pull docker images. Otherwise, additional configuration is required (See [Offline Environment](docs/offline-environment.md)) - The target servers are configured to allow **IPv4 forwarding**. - If using IPv6 for pods and services, the target servers are configured to allow **IPv6 forwarding**. diff --git a/ansible_version.yml b/ansible_version.yml index 268136df2..da19e9698 100644 --- a/ansible_version.yml +++ b/ansible_version.yml @@ -4,7 +4,7 @@ become: no vars: minimal_ansible_version: 2.9.0 - maximal_ansible_version: 2.10.0 + maximal_ansible_version: 2.11.0 ansible_connection: local tasks: - name: "Check {{ minimal_ansible_version }} <= Ansible version < {{ maximal_ansible_version }}" diff --git a/roles/kubernetes-apps/ansible/tasks/coredns.yml b/roles/kubernetes-apps/ansible/tasks/coredns.yml index 0bbb269a0..4570b260a 100644 --- a/roles/kubernetes-apps/ansible/tasks/coredns.yml +++ b/roles/kubernetes-apps/ansible/tasks/coredns.yml @@ -1,20 +1,19 @@ --- -- name: Kubernetes Apps | Lay Down CoreDNS Template - action: "{{ item.module }}" - args: - src: "{{ item.file }}{% if item.module == 'template' %}.j2{% endif %}" +- name: Kubernetes Apps | Lay Down CoreDNS templates + template: + src: "{{ item.file }}.j2" dest: "{{ kube_config_dir }}/{{ item.file }}" - with_items: - - { name: coredns, module: template, file: coredns-config.yml, type: configmap } - - { name: coredns, module: copy, file: coredns-sa.yml, type: sa } - - { name: coredns, module: template, file: coredns-deployment.yml, type: deployment } - - { name: coredns, module: template, file: coredns-svc.yml, type: svc } - - { name: coredns, module: copy, file: coredns-clusterrole.yml, type: clusterrole } - - { name: coredns, module: copy, file: coredns-clusterrolebinding.yml, type: clusterrolebinding } - - { name: dns-autoscaler, module: copy, file: dns-autoscaler-sa.yml, type: sa } - - { name: dns-autoscaler, module: copy, file: dns-autoscaler-clusterrole.yml, type: clusterrole } - - { name: dns-autoscaler, module: copy, file: dns-autoscaler-clusterrolebinding.yml, type: clusterrolebinding } - - { name: dns-autoscaler, module: template, file: dns-autoscaler.yml, type: deployment } + loop: + - { name: coredns, file: coredns-clusterrole.yml, type: clusterrole } + - { name: coredns, file: coredns-clusterrolebinding.yml, type: clusterrolebinding } + - { name: coredns, file: coredns-config.yml, type: configmap } + - { name: coredns, file: coredns-deployment.yml, type: deployment } + - { name: coredns, file: coredns-sa.yml, type: sa } + - { name: coredns, file: coredns-svc.yml, type: svc } + - { name: dns-autoscaler, file: dns-autoscaler.yml, type: deployment } + - { name: dns-autoscaler, file: dns-autoscaler-clusterrole.yml, type: clusterrole } + - { name: dns-autoscaler, file: dns-autoscaler-clusterrolebinding.yml, type: clusterrolebinding } + - { name: dns-autoscaler, file: dns-autoscaler-sa.yml, type: sa } register: coredns_manifests vars: clusterIP: "{{ skydns_server }}" diff --git a/roles/kubernetes-apps/ansible/files/coredns-clusterrole.yml b/roles/kubernetes-apps/ansible/templates/coredns-clusterrole.yml.j2 similarity index 100% rename from roles/kubernetes-apps/ansible/files/coredns-clusterrole.yml rename to roles/kubernetes-apps/ansible/templates/coredns-clusterrole.yml.j2 diff --git a/roles/kubernetes-apps/ansible/files/coredns-clusterrolebinding.yml b/roles/kubernetes-apps/ansible/templates/coredns-clusterrolebinding.yml.j2 similarity index 100% rename from roles/kubernetes-apps/ansible/files/coredns-clusterrolebinding.yml rename to roles/kubernetes-apps/ansible/templates/coredns-clusterrolebinding.yml.j2 diff --git a/roles/kubernetes-apps/ansible/files/coredns-sa.yml b/roles/kubernetes-apps/ansible/templates/coredns-sa.yml.j2 similarity index 100% rename from roles/kubernetes-apps/ansible/files/coredns-sa.yml rename to roles/kubernetes-apps/ansible/templates/coredns-sa.yml.j2 diff --git a/roles/kubernetes-apps/ansible/dns-autoscaler-clusterrole.yml b/roles/kubernetes-apps/ansible/templates/dns-autoscaler-clusterrole.yml.j2 similarity index 100% rename from roles/kubernetes-apps/ansible/dns-autoscaler-clusterrole.yml rename to roles/kubernetes-apps/ansible/templates/dns-autoscaler-clusterrole.yml.j2 diff --git a/roles/kubernetes-apps/ansible/dns-autoscaler-clusterrolebinding.yml b/roles/kubernetes-apps/ansible/templates/dns-autoscaler-clusterrolebinding.yml.j2 similarity index 100% rename from roles/kubernetes-apps/ansible/dns-autoscaler-clusterrolebinding.yml rename to roles/kubernetes-apps/ansible/templates/dns-autoscaler-clusterrolebinding.yml.j2 diff --git a/roles/kubernetes-apps/ansible/files/dns-autoscaler-sa.yml b/roles/kubernetes-apps/ansible/templates/dns-autoscaler-sa.yml.j2 similarity index 100% rename from roles/kubernetes-apps/ansible/files/dns-autoscaler-sa.yml rename to roles/kubernetes-apps/ansible/templates/dns-autoscaler-sa.yml.j2