Commit Graph

15 Commits

Author SHA1 Message Date
Guillaume A
f2aed3ba47 Automatically inject tls-san when api_endpoint differs from hostname (#434)
* Auto-add --tls-san={{ api_endpoint }} when it differs from ansible_hostname
* Ensures first server generates certificate with all required SANs
* Add .ansible/ and PR_DESCRIPTION.md to gitignore

Signed-off-by: Guillaume Andre <mail@guillaumea.fr>
2025-09-15 11:21:20 -07:00
Derek Nola
cd543a660d Inject installation envs for install script (#433)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2025-08-26 09:57:53 -07:00
fch-aa
66385e35eb fix(agent): Use proper env file path during provisioning. (#421)
Signed-off-by: fch-aa <21101725+fch-aa@users.noreply.github.com>
Co-authored-by: fch-aa <21101725+fch-aa@users.noreply.github.com>
2025-07-10 09:35:25 -07:00
Zero King
1067f630f5 Add service environment variables to all hosts (#416)
Signed-off-by: Zero King <l2dy@icloud.com>
2025-06-04 08:54:25 -06:00
Will
c8527cc9ee improve check mode support, allow for agent config yaml, restart service if config changed (#388)
Signed-off-by: Will Brown <will@wbrwn.co>
Co-authored-by: Will Brown <will@wbrwn.co>
2025-01-28 09:15:09 -08:00
anon-software
c10b84f0f4 enable autogenerating token (#375)
* Generate token

If a token is not explicitly provided, let the first server generate a
random one. Such a token is saved on the first server and the playbook
can retrieve it from there and store it a a fact. All other servers and
agents can use that token later to join the cluster. It will be saved
into their environment file as usual.

Signed-off-by: Marko Vukovic <8951449+anon-software@users.noreply.github.com>

* Document that token is (mostly) optional now

The token is still required when using Vagrant.

Signed-off-by: Marko Vukovic <8951449+anon-software@users.noreply.github.com>
2024-11-11 13:07:31 -08:00
Derek Nola
2d38507c70 Fix order of operations when install agent airgap (#373)
Signed-off-by: Derek Nola <derek.nola@suse.com>
2024-10-28 11:43:06 -07:00
anon-software
040d37878b Prevent multiple tokens in k3s.service.env (#364)
* Prevent multiple tokens in k3s.service.env

If site.yml playbook is executed multiple times with different tokens,
they will all accumulate in k3s.service.env. They won't do any harm
because the last one wins, however it is a matter of good housekeeping
to delete the old before inserting a new one.

Signed-off-by: Marko Vukovic <8951449+anon-software@users.noreply.github.com>

* Selectively remove existing token from the environment file

If the existing token in the environment file is the same as the token
used for the playbook run, leave it in the file to avoid false changed
status from the task.

Signed-off-by: Marko Vukovic <8951449+anon-software@users.noreply.github.com>

---------

Signed-off-by: Marko Vukovic <8951449+anon-software@users.noreply.github.com>
2024-10-07 09:44:28 -07:00
james-otten
bc03d1c0d0 Fix adding token to existing cluster (#360)
Signed-off-by: James Otten <jamesotten1@gmail.com>
2024-09-12 09:54:11 -07:00
anon-software
2d98982809 Security exposure related to the token (#356)
* Security exposure related to the token

The installation playbook saves the token into the systemd unit
configuration file /etc/systemd/system/k3s.service. The problem is that
according to K3s' documentation "the server token should be guarded
carefully" (https://docs.k3s.io/cli/token), yet the configuration file
is readable by anybody. A better solution is to save the token into its
corresponding environment file /etc/systemd/system/k3s.service.env which
is readable by the super user only. This is what the standard K3s'
installation script (https://get.k3s.io) does.

Signed-off-by: Marko Vukovic <8951449+anon-software@users.noreply.github.com>

* Restore the server URL into systemd configuration file

There aren't any security implications in keeping it there.

Signed-off-by: Marko Vukovic <8951449+anon-software@users.noreply.github.com>

---------

Signed-off-by: Marko Vukovic <8951449+anon-software@users.noreply.github.com>
2024-09-04 14:02:52 -07:00
Derek Nola
af29159231 Implement compatible yamllint, make octals explicit (#332)
* Implement compatible yamllint, make octals explicit

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Replace yum with dnf, yum is deprecated

Signed-off-by: Derek Nola <derek.nola@suse.com>

---------

Signed-off-by: Derek Nola <derek.nola@suse.com>
2024-06-04 09:56:07 -07:00
Mykyta Orlov
5dd8c3f5a3 Fix typo in main.yml (#317)
Signed-off-by: Mykyta Orlov <orlovmyk@gmail.com>
2024-04-01 11:15:20 -07:00
LawiK974
a2916230ba Check K3s installed version before download tasks (#297)
- [Agent : Download artefact only if needed](roles/k3s_agent/tasks/main.yml#L13)
- [Server : Download artefact only if needed](roles/k3s_server/tasks/main.yml#L13)
- [Upgrade : Upgrade node only if needed](roles/k3s_upgrade/tasks/main.yml#L14)

Linked issue #264 k3s_server and k3s_agent tasks are not idempotent

Signed-off-by: Loïc Dubard <loic97429@gmail.com>
2024-03-07 16:05:07 -08:00
Jon S. Stumpf
4d6e60281e Role tweaks (#268)
* Limited boolean values to true/false;

Signed-off-by: Jon S. Stumpf <jon.stumpf@gmail.com>

* Moved ArchLinux prereq task to be a handler;

Signed-off-by: Jon S. Stumpf <jon.stumpf@gmail.com>

* Standardized task name for adding cgroup support;

Signed-off-by: Jon S. Stumpf <jon.stumpf@gmail.com>

* Have backrefs: follow path:;

Signed-off-by: Jon S. Stumpf <jon.stumpf@gmail.com>

* Addressed ansible-lint errors;

Signed-off-by: Jon S. Stumpf <jon.stumpf@gmail.com>

* Fixed #264, task 7: Copy K3s service file;

Signed-off-by: Jon S. Stumpf <jon.stumpf@gmail.com>

---------

Signed-off-by: Jon S. Stumpf <jon.stumpf@gmail.com>
2023-12-04 09:46:45 -08:00
Derek Nola
1e633c5ad1 Rework Role Structure (#254)
* Add more defaults
* Rename roles, covert download to airgap role
* Remove unnecessary gather_facts

Signed-off-by: Derek Nola <derek.nola@suse.com>
2023-11-16 12:03:07 -08:00