forked from kubernetes-sigs/kubespray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for Ansible collections (kubernetes-sigs#9582)
- Loading branch information
Showing
28 changed files
with
1,104 additions
and
899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,131 +1,3 @@ | ||
--- | ||
- name: Check ansible version | ||
import_playbook: ansible_version.yml | ||
|
||
- name: Ensure compatibility with old groups | ||
import_playbook: legacy_groups.yml | ||
|
||
- hosts: bastion[0] | ||
gather_facts: False | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: bastion-ssh-config, tags: ["localhost", "bastion"] } | ||
|
||
- hosts: k8s_cluster:etcd | ||
strategy: linear | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
gather_facts: false | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: bootstrap-os, tags: bootstrap-os} | ||
|
||
- name: Gather facts | ||
tags: always | ||
import_playbook: facts.yml | ||
|
||
- hosts: k8s_cluster:etcd | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: kubernetes/preinstall, tags: preinstall } | ||
- { role: "container-engine", tags: "container-engine", when: deploy_container_engine } | ||
- { role: download, tags: download, when: "not skip_downloads" } | ||
|
||
- hosts: etcd:kube_control_plane | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- role: etcd | ||
tags: etcd | ||
vars: | ||
etcd_cluster_setup: true | ||
etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" | ||
when: etcd_deployment_type != "kubeadm" | ||
|
||
- hosts: k8s_cluster | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- role: etcd | ||
tags: etcd | ||
vars: | ||
etcd_cluster_setup: false | ||
etcd_events_cluster_setup: false | ||
when: | ||
- etcd_deployment_type != "kubeadm" | ||
- kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool | ||
- kube_network_plugin != "calico" or calico_datastore == "etcd" | ||
|
||
- hosts: k8s_cluster | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: kubernetes/node, tags: node } | ||
|
||
- hosts: kube_control_plane | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: kubernetes/control-plane, tags: master } | ||
- { role: kubernetes/client, tags: client } | ||
- { role: kubernetes-apps/cluster_roles, tags: cluster-roles } | ||
|
||
- hosts: k8s_cluster | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: kubernetes/kubeadm, tags: kubeadm} | ||
- { role: kubernetes/node-label, tags: node-label } | ||
- { role: network_plugin, tags: network } | ||
|
||
- hosts: calico_rr | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: network_plugin/calico/rr, tags: ['network', 'calico_rr'] } | ||
|
||
- hosts: kube_control_plane[0] | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: win_nodes/kubernetes_patch, tags: ["master", "win_nodes"] } | ||
|
||
- hosts: kube_control_plane | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: kubernetes-apps/external_cloud_controller, tags: external-cloud-controller } | ||
- { role: kubernetes-apps/network_plugin, tags: network } | ||
- { role: kubernetes-apps/policy_controller, tags: policy-controller } | ||
- { role: kubernetes-apps/ingress_controller, tags: ingress-controller } | ||
- { role: kubernetes-apps/external_provisioner, tags: external-provisioner } | ||
- { role: kubernetes-apps, tags: apps } | ||
|
||
- name: Apply resolv.conf changes now that cluster DNS is up | ||
hosts: k8s_cluster | ||
gather_facts: False | ||
any_errors_fatal: "{{ any_errors_fatal | default(true) }}" | ||
environment: "{{ proxy_disable_env }}" | ||
roles: | ||
- { role: kubespray-defaults } | ||
- { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true } | ||
- name: Install Kubernetes | ||
ansible.builtin.import_playbook: playbooks/cluster.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Ansible collection | ||
|
||
Kubespray can be installed as an [Ansible collection](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html). | ||
|
||
## Requirements | ||
|
||
- An inventory file with the appropriate host groups. See the [README](../README.md#usage). | ||
- A `group_vars` directory. These group variables **need** to match the appropriate variable names under `inventory/local/group_vars`. See the [README](../README.md#usage). | ||
|
||
## Usage | ||
|
||
1. Add Kubespray to your requirements.yml file | ||
|
||
```yaml | ||
collections: | ||
- name: https://github.com/kubernetes_sigs/kubespray | ||
type: git | ||
version: v2.21.0 | ||
``` | ||
2. Install your collection | ||
```ShellSession | ||
ansible-galaxy install -r requirements.yml | ||
``` | ||
|
||
3. Create a playbook to install your Kubernetes cluster | ||
|
||
```yaml | ||
- name: Install Kubernetes | ||
ansible.builtin.import_playbook: kubernetes_sigs.kubespray.cluster | ||
``` | ||
4. Update INVENTORY and PLAYBOOK so that they point to your inventory file and the playbook you created above, and then install Kubespray | ||
```ShellSession | ||
ansible-playbook -i INVENTORY --become --become-user=root PLAYBOOK | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
namespace: kubernetes_sigs | ||
description: Deploy a production ready Kubernetes cluster | ||
name: kubespray | ||
version: 2.21.0 | ||
readme: README.md | ||
authors: | ||
- luksi1 | ||
tags: | ||
- kubernetes | ||
- kubespray | ||
repository: https://github.com/kubernetes-sigs/kubespray | ||
build_ignore: | ||
- .github | ||
- '*.tar.gz' | ||
- extra_playbooks | ||
- inventory | ||
- scripts | ||
- test-infra | ||
- .ansible-lint | ||
- .editorconfig | ||
- .gitignore | ||
- .gitlab-ci | ||
- .gitlab-ci.yml | ||
- .gitmodules | ||
- .markdownlint.yaml | ||
- .nojekyll | ||
- .pre-commit-config.yaml | ||
- .yamllint | ||
- Dockerfile | ||
- FILES.json | ||
- MANIFEST.json | ||
- Makefile | ||
- Vagrantfile | ||
- _config.yml | ||
- ansible.cfg | ||
- requirements*txt | ||
- setup.cfg | ||
- setup.py | ||
- index.html | ||
- reset.yml | ||
- cluster.yml | ||
- scale.yml | ||
- recover-control-plane.yml | ||
- remove-node.yml | ||
- upgrade-cluster.yml | ||
- library |
Oops, something went wrong.