Commit Graph

164 Commits

Author SHA1 Message Date
fragpit
b87991cc28
Compare kubectl get nodes with ansible_hostname, not ansible_fqdn/i… (#212)
Co-authored-by: Igor Tretyak <itretyak@ptsecurity.com>
2023-12-09 08:32:47 -05:00
Xan Manning
37cca2e487
Merge pull request #208 from matteyeux/main
Create registries.yaml if k3s_registries.mirrors or k3s_registries.configs are not None
2023-06-17 11:36:15 +01:00
matteyeux
cc64737bdc Create registries.yaml only if k3s_registries.mirrors or k3s_registries.configs are not empty 2023-06-01 14:34:17 +02:00
Devin Buhl
3f1d2da21b
fix: static pods should be deployed to all control nodes
Signed-off-by: Devin Buhl <devin@buhl.casa>
2023-05-31 20:39:15 -04:00
Daniel Brennand
de1bd094e5
Fix(tests): Resolve Ansible Lint warnings and fix Molecule tests on GitHub Actions (#202)
* fix(ansible-lint): FQDN and `name`

* fix(ansible-lint): add `name` and FQDN for module call

* fix(ansible-lint): add `name` to tasks and FQDN for module

* fix(ansible-lint): add task `name` and FQDN for module calls

* fix(ansible-lint): last `include_tasks`

* fix(ansible-lint): add task names and FQDN

* refactor: `Ensure` to `Run`

* [skip ci]refactor: add exist and seperate ensure installed node task, mention build cluster

* [skip ci]refactor: Pipe seperator

* [skip ci]refactor: run

* refactor: remove quotes as other files don't use them

For templated vars in task name

* [skip ci]refactor: task names, use `Run`

* [skip ci]refactor: use variable name in task name

* [skip ci]refactor: task names

* [skip ci]refactor: add service mgr in task name

* [skip ci]refactor: add task names and module FQDNs

* [skip ci]refactor: fix task name

* [skip ci]refactor: add -

* [skip ci]refactor: include task names and FQDNs

* [skip ci]refactor: add task names and FQDNs

* [skip ci]: ignore `name[template]`

* refactor: `when` clause for `block` should be before `block`

* fix: https://github.com/ansible-community/molecule/issues/3883

* refactor: molecule lint command was removed in version `5.0.0`

Use separate CI job step to run linting instead.

* [skip ci]refactor: noqa for command tasks

Subject to change

* refactor: use Ubuntu 22.04

Suspect issues with Molecule tests are related to cgroups v2.
2023-05-13 09:49:39 -04:00
Xan Manning
e9ddc8738a
fix(post-check): shorten node check delay to 5 seconds 2022-09-02 18:49:42 +01:00
Xan Manning
561d67cd08
fix(version): ensure log output provided when version lookup fails 2022-09-02 18:09:23 +01:00
Xan Manning
21fe3bccbf
feat(post-checks): add option to skip post-checks 2022-09-02 18:02:06 +01:00
Xan Manning
25a17b8511
fix(linting): ensure tests pass 2022-09-01 20:39:17 +01:00
Xan Manning
e6cb2a91e8 fix: autodeploy fix 2022-06-15 21:36:14 +00:00
Xan Manning
5bebced657 fix: control plane start retries 2022-06-15 21:03:39 +00:00
Xan Manning
13ed1336d9 fix: service handler missing from ansible handler 2022-06-15 20:28:13 +01:00
Xan Manning
5f560137f4 fix(alpine): testing in molecule and rename service 2022-06-15 18:45:54 +01:00
Xan Manning
910b611058 WIP(alpine): trying to find a container image that supports openrc 2022-06-15 15:14:59 +01:00
Xan Manning
86a9f25325 fix(cluster-token): cluster tokens can now be specified without breaking configurations where cluster tokens are auto-generated 2022-05-29 18:55:01 +01:00
Xan Manning
87551613d4
Merge pull request #184 from PyratLabs/fix/molecule-tests
fix(molecule): fix tests by ensuring fqcn is specified
2022-05-02 17:14:18 +01:00
Xan Manning
03bc3aec5b fix(molecule): fix tests by ensuring fqcn is specified 2022-05-02 17:13:12 +01:00
Vladimir Romashchenko
d1f61bf866
fix: Support nftables for Debian 11 2022-02-15 15:57:43 -05:00
Karsten Kosmala
1475d1724d
add missing bracket
Co-authored-by: Xan Manning <244186+xanmanning@users.noreply.github.com>
2022-01-30 12:08:34 +01:00
Karsten Kosmala
80eca60031
add missing bracket
Co-authored-by: Xan Manning <244186+xanmanning@users.noreply.github.com>
2022-01-30 12:08:22 +01:00
Karsten Kosmala
424145881c use basename of url for items in k3s_server_manifests_urls and k3s_server_pod_manifests_urls if filename is not provided
Signed-off-by: Karsten Kosmala <kosmala@cosmocode.de>
2022-01-20 11:13:32 +01:00
Alejo Diaz
4f0bb3f9a7
Adding become to pre checks packages
To make sure that system packages are found with `which` in
distributions like Debian for example.
2022-01-06 09:49:26 -03:00
Xan Manning
7e9292c01b fix(become): only one variable neeed for become 2022-01-02 22:20:14 +00:00
Xan Manning
a88d27d2ae feat: Remove Docker install tasks 2022-01-02 22:19:51 +00:00
Xan Manning
377565de96 fix(airgap): moved from vars to defaults 2022-01-02 21:10:48 +00:00
Xan Manning
0873fc4977 fix(rootless): attempt to resolve rootless issues in debian #161 2021-12-27 13:19:32 -05:00
Xan Manning
0fa1ef29a9 fix(start): annoying behaviour where k3s won't start as a single node in ha etcd #152 2021-12-27 13:19:32 -05:00
Xan Manning
e457854046 fix(validation): distribution and version for packages 2021-12-27 13:19:32 -05:00
Xan Manning
cc8ba00de2 feat(validate): package check for iptables on debian 2021-12-27 13:19:32 -05:00
Curtis John
dd3c460bfa
feat(airgap): skip evaluations that aren't relevant to airgap
checking release version and tasks that depend on that check do not need to function since we won't
be aware of the version in an airgapped deployment
2021-12-15 16:43:51 -05:00
Curtis John
f7c0c8783a
feat(airgap): airgap should not verify version information
in an air gapped environment the machine will not be able to check sha checksums or information
around the binary so we should ignore the tasks in that scenario
2021-12-15 12:15:25 -05:00
Curtis John
8243baa3d9
feat(airgap): airgap should not verify version information
in an air gapped environment the machine will not be able to check sha checksums or information
around the binary so we should ignore the tasks in that scenario
2021-12-15 12:14:24 -05:00
Curtis John
25d40cec52
style(airgap): task name should reflect action taken 2021-12-15 12:11:25 -05:00
Curtis John
b8727a1c92
chore(airgap): noting future work 2021-12-14 17:45:20 -05:00
Curtis John
4bcf3ea9c4
fix(airgap): hotwire k3s version var to end of binary name
this is to allow the role to proceed as if the binary was downloaded as expected from the web
2021-12-14 17:33:31 -05:00
Curtis John
e88f3bb056
feat(airgap): init airgap feature
airgap installs allow users to deploy k3s in a situation where the server is not internet connected
and therefore unable to download anything externally
2021-12-14 17:16:19 -05:00
Xan Manning
db3f7da362 fix(uninstall): deprecated drain flag removed in 1.22
fixes #159
2021-10-10 14:07:04 +01:00
Devin Buhl
0384dfcb4f
feat: implement config.yaml.d 2021-09-06 08:54:33 -04:00
Devin Buhl
207fbbd41a
feat: implement config.yaml.d 2021-09-06 08:47:37 -04:00
Devin Buhl
9db46b536d
feat: implement config.yaml.d 2021-09-06 08:46:49 -04:00
Xan Manning
077c9a3fd6 bugfix: k3s_runtime_config 2021-08-18 20:44:06 +01:00
Xan Manning
f198b45d58 used combined configuration from vars.yaml, removed duplicated task for control plane 2021-08-14 14:04:56 +01:00
Anes Belfodil
c0ec5ca930
Add advertised_address 2021-08-09 17:53:28 -04:00
Xan Manning
ba113bcd05 Fix primary control node delegation 2021-07-24 17:38:45 +01:00
Xan Manning
e90448f40b Updated systemd template to use token when joining a cluster 2021-07-24 17:21:31 +01:00
Xan Manning
3b5c6e6ff5
Merge pull request #136 from Yajo/patch-1
fix: do ignore etcd member count when uninstalling
2021-07-21 20:29:31 +01:00
Yajo
4b42a9bf49 fix: restore clustering feature
For some weird reason, string booleans were set on `k3s_control_node` and `k3s_primary_control_node`, making their behavior non-obvious (for python `bool("false") == True`).

This fixes that problem, and BTW restores the ability to create clusters, which got lost with this bug.

After running the role against a cluster, see:

```sh
❯ ansible -i inventories/testing.yaml k8s_node -m command -ba 'kubectl get node'
vm0 | CHANGED | rc=0 >>
NAME   STATUS   ROLES                       AGE     VERSION
vm0    Ready    control-plane,etcd,master   9m19s   v1.21.2+k3s1
vm2 | CHANGED | rc=0 >>
NAME   STATUS   ROLES                       AGE     VERSION
vm2    Ready    control-plane,etcd,master   9m22s   v1.21.2+k3s1
vm1 | CHANGED | rc=0 >>
NAME   STATUS   ROLES                       AGE     VERSION
vm1    Ready    control-plane,etcd,master   9m22s   v1.21.2+k3s1
```

Now, after the patch:

```sh
❯ ansible -i inventories/testing.yaml k8s_node -m command -ba 'kubectl get node'
vm0 | CHANGED | rc=0 >>
NAME   STATUS   ROLES                       AGE    VERSION
vm0    Ready    control-plane,etcd,master   2m2s   v1.21.2+k3s1
vm1    Ready    control-plane,etcd,master   58s    v1.21.2+k3s1
vm2    Ready    control-plane,etcd,master   80s    v1.21.2+k3s1
vm1 | CHANGED | rc=0 >>
NAME   STATUS   ROLES                       AGE    VERSION
vm0    Ready    control-plane,etcd,master   2m2s   v1.21.2+k3s1
vm1    Ready    control-plane,etcd,master   58s    v1.21.2+k3s1
vm2    Ready    control-plane,etcd,master   80s    v1.21.2+k3s1
vm2 | CHANGED | rc=0 >>
NAME   STATUS   ROLES                       AGE    VERSION
vm0    Ready    control-plane,etcd,master   2m2s   v1.21.2+k3s1
vm1    Ready    control-plane,etcd,master   58s    v1.21.2+k3s1
vm2    Ready    control-plane,etcd,master   80s    v1.21.2+k3s1
```

@Tecnativa TT2541
2021-07-21 12:37:17 +00:00
Jairo Llopis
142b40f428
fix: do ignore etcd member count when uninstalling
Otherwise, when completely uninstalling the etcd-enabled cluster, it fails with:

```
TASK [xanmanning.k3s : Check the conditions when embedded etcd is defined] ***************************************
fatal: [vm0]: FAILED! => {
    "assertion": "(((k3s_controller_list | length) % 2) == 1)",
    "changed": false,
    "evaluated_to": false,
    "msg": "Etcd should have a minimum of 3 defined members and the number of members should be odd. Please see notes about HA in README.md"
}
fatal: [vm1]: FAILED! => {
    "assertion": "(((k3s_controller_list | length) % 2) == 1)",
    "changed": false,
    "evaluated_to": false,
    "msg": "Etcd should have a minimum of 3 defined members and the number of members should be odd. Please see notes about HA in README.md"
}
fatal: [vm2]: FAILED! => {
    "assertion": "(((k3s_controller_list | length) % 2) == 1)",
    "changed": false,
    "evaluated_to": false,
    "msg": "Etcd should have a minimum of 3 defined members and the number of members should be odd. Please see notes about HA in README.md"
}
```
2021-07-21 12:56:09 +01:00
Yajo
05e62b6344 fix: avoid failure with jinja2_native=true
If you run the role on an ansible configured with that setting, it will fail with:

    fatal: [vm0]: FAILED! => {"msg": "Unexpected templating type error occurred on ({% for host in ansible_play_hosts_all %}\n{% filter string %}\n{% filter replace('\\n', ' ') %}\n{{ host }}\n@@@\n{{ hostvars[host].ansible_host | default(hostvars[host].ansible_fqdn) }}\n@@@\nC_{{ hostvars[host].k3s_control_node }}\n@@@\nP_{{ hostvars[host].k3s_primary_control_node | default(False) }}\n{% endfilter %}\n{% endfilter %}\n@@@ END:{{ host }}\n{% endfor %}): sequence item 4: expected str instance, bool found"}
2021-07-19 09:26:57 +00:00
Michael Robinson
3006716f66
Case insensitive control node lookup 2021-05-29 14:26:50 -06:00