mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-12-25 00:12:37 +01:00
chore: document how to incorporate into existing project
* chore: document that you need to run the airgap role Signed-off-by: Mörgæsis <morgaesis+git@morgaes.is>
This commit is contained in:
23
README.md
23
README.md
@@ -32,7 +32,7 @@ It is also recommended that all managed nodes disable firewalls and swap. See [K
|
|||||||
|
|
||||||
### With ansible-galaxy
|
### With ansible-galaxy
|
||||||
|
|
||||||
`k3s-ansible` is a Ansible collection and can be installed with the `ansible-galaxy` command:
|
`k3s-ansible` is an Ansible collection and can be installed with the `ansible-galaxy` command:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ ansible-galaxy collection install git+https://github.com/k3s-io/k3s-ansible.git
|
$ ansible-galaxy collection install git+https://github.com/k3s-io/k3s-ansible.git
|
||||||
@@ -103,6 +103,23 @@ ansible-playbook k3s.orchestration.site -i inventory.yml
|
|||||||
ansible-playbook playbooks/site.yml -i inventory.yml
|
ansible-playbook playbooks/site.yml -i inventory.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Alternatively, to run the playbook from your existing project setup, run the playbook from within your own playbook:
|
||||||
|
|
||||||
|
*Installed with ansible-galaxy*
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Import kube cluster playbook
|
||||||
|
ansible.builtin.import_playbook: k3s-ansible/playbooks/site.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
*Running the playbook from inside the repository*
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Import kube cluster playbook
|
||||||
|
ansible.builtin.import_playbook: k3s.orchestration.site
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Using an external database
|
### Using an external database
|
||||||
|
|
||||||
If an external database is preferred, this can be achieved by passing the `--datastore-endpoint` as an extra server argument as well as setting the `use_external_database` flag to true.
|
If an external database is preferred, this can be achieved by passing the `--datastore-endpoint` as an extra server argument as well as setting the `use_external_database` flag to true.
|
||||||
@@ -146,7 +163,7 @@ ansible-playbook playbooks/upgrade.yml -i inventory.yml
|
|||||||
|
|
||||||
## Airgap Install
|
## Airgap Install
|
||||||
|
|
||||||
Airgap installation is supported via the `airgap_dir` variable. This variable should be set to the path of a directory containing the K3s binary and images. The release artifacts can be downloaded from the [K3s Releases](https://github.com/k3s-io/k3s/releases). You must download the appropriate images for you architecture (any of the compression formats will work).
|
Airgap installation is supported via the `airgap_dir` variable. This variable should be set to the path of a directory containing the K3s binary and images. The release artifacts can be downloaded from the [K3s Releases](https://github.com/k3s-io/k3s/releases). You must download the appropriate images for you architecture (any of the compression formats will work). Additionally, you must run the `airgap` role to set up the airgapped environment.
|
||||||
|
|
||||||
An example folder for an x86_64 cluster:
|
An example folder for an x86_64 cluster:
|
||||||
```bash
|
```bash
|
||||||
@@ -160,7 +177,7 @@ $ cat inventory.yml
|
|||||||
airgap_dir: ./my-airgap # Paths are relative to the playbooks directory
|
airgap_dir: ./my-airgap # Paths are relative to the playbooks directory
|
||||||
```
|
```
|
||||||
|
|
||||||
Additionally, if deploying on a OS with SELinux, you will also need to download the latest [k3s-selinux RPM](https://github.com/k3s-io/k3s-selinux/releases/latest) and place it in the airgap folder.
|
Additionally, if deploying on an OS with SELinux, you will also need to download the latest [k3s-selinux RPM](https://github.com/k3s-io/k3s-selinux/releases/latest) and place it in the airgap folder.
|
||||||
|
|
||||||
|
|
||||||
It is assumed that the control node has access to the internet. The playbook will automatically download the k3s install script on the control node, and then distribute all three artifacts to the managed nodes.
|
It is assumed that the control node has access to the internet. The playbook will automatically download the k3s install script on the control node, and then distribute all three artifacts to the managed nodes.
|
||||||
|
|||||||
Reference in New Issue
Block a user