Commit graph

124 commits

Author SHA1 Message Date
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
Xan Manning
730edbf6cb Skip downloads in check-mode 2021-05-27 19:31:28 +01:00
ᗪєνιη ᗷυнʟ
e7374757fa
fix: task item name 2021-05-27 11:58:45 -04:00
ᗪєνιη ᗷυнʟ
51de880c0f
fix: use k3s_server_pod_manifests_dir for static pod urls 2021-05-27 11:57:42 -04:00
Devin Buhl
2e629838f1
feat: add support for specifying URLs in templates 2021-05-26 18:07:22 -04:00
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs
d834ca15b0
Merge branch 'main' into staticpods 2021-05-26 09:57:58 +02:00
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs
da7d8c67d9
Rename vars, path
Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
2021-05-26 09:52:34 +02:00
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs
1bbba04230
Allow control plane static pods
Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs <me@bjw-s.dev>
2021-05-26 09:43:07 +02:00
ᗪєνιη ᗷυнʟ
82085cb80b
fix: remove run_once 2021-05-25 19:23:13 -04:00
ᗪєνιη ᗷυнʟ
2243766695
fix: k3s_primary_control_node 2021-05-25 18:39:48 -04:00
ᗪєνιη ᗷυнʟ
ef99954177
fix: only deploy k3s_server_manifests_dir on primary controller 2021-05-25 18:38:07 -04:00
Xan Manning
50fa321e7e Fix templating error 2021-05-15 20:47:32 +01:00
赵安家
d563dcca05 style(k3s): change code style
change code style
2021-05-08 18:39:19 +08:00
赵安家
075ef165c5 fix(k3s): fix k3s's private-registry configuration not exist
fix k3s's private-registry configuration not exist
2021-05-07 18:29:01 +08:00
赵安家
c9e2b619d1 feat(k3s): support k3s's private-registry configuration
rancher doc url https://rancher.com/docs/k3s/latest/en/installation/private-registry/
2021-05-07 17:56:45 +08:00
AnJia
91d456ccad
fixed kubectl_get_nodes_result.stdout error
os ubuntu  amd64 16.04 LTS
ansible 2.9.20
python version 2.7

```
 FAILED! => {"msg": "The conditional check 'item in kubectl_get_nodes_result.stdout' failed. The error was: error while evaluating conditional (item in kubectl_get_nodes_result.stdout): 'dict object' has no attribute 'stdout'\n\nThe error appears to be in '/home/rancher/.ansible/roles/xanmanning.k3s/tasks/teardown/drain-and-remove-nodes.yml': line 39, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Ensure uninstalled nodes are removed\n      ^ here\n"}

```
2021-04-30 14:31:33 +08:00
Xan Manning
f4fcd2897d Update test sequence for check mode, fixed check mode on cgroup test 2021-04-18 20:39:06 +01:00
Xan Manning
23054c76f6 Updated command modules to use cmd argument 2021-04-10 12:31:18 +01:00
Xan Manning
e5c69ec894 Add cgroup checks 2021-04-03 20:42:44 +01:00
Xan Manning
4326f4497d Renamed k3s_control_node_address -> k3s_registration_address 2021-03-14 16:29:14 +00:00
Xan Manning
94a153892e Bugfix, missing become on cluser token check 2021-02-28 17:36:30 +00:00
Xan Manning
1d93c2115d Cluster-init checks added, tidy up of task format 2021-02-28 16:48:23 +00:00
Xan Manning
62b2d7cb36 Typo bugfixes 2021-02-27 19:02:49 +00:00
Xan Manning
7e4a16e167 Pre-documentation work
- Restructured when and asserts
  - Standardise molecule call, add systemd config
2021-02-16 16:53:49 +00:00
Xan Manning
5555bd3d9b Bugfix, missing k3s_start_on_boot to control systemd.enabled added. 2021-01-30 17:57:50 +00:00
Xan Manning
2c12436226 Bugfixes
- Added uninstall task to remove hard-linked files #88
  - Fixed missing become for `systemd` operations tasks. #89
  - Added `k3s_start_on_boot` to control `systemd.enabled`.
2021-01-30 17:23:31 +00:00
Antoine Bertin
c169cb8937
Fix check nodes ready without flannel
Fixes #84
2021-01-22 00:28:53 +01:00
Xan Manning
e954ba13c4 Bugfix: Docker check still failing on "false" 2021-01-10 16:35:20 +00:00
Xan Manning
a2e035cd1c Bugfix registry 2021-01-02 16:33:31 +00:00
Xan Manning
e7c714424c
Tiidy up and refactoring of tasks (#80)
* Tidy up and refactoring of tasks

  - `k3s_config_dir` derived from `k3s_config_file`, reused throughout the role
    to allow for easy removal of "Rancher" references #73.
  - `k3s_token_location` has moved to be in `k3s_config_dir`.
  - Tasks for creating directories now looped to caputure configuration from
    `k3s_server` and `k3s_agent` and ensure directories exist before k3s
    starts, see #75.
  - Server token collected directly from token file, not symlinked file
    (node-token).
  - `k3s_runtime_config` defined in `vars/` for validation and overwritten in
    tasks for control plane and workers.
  - Removed unused references to GitHub API.

* set_fact now uses FQCN

* re-pin molecule<3.2

* Command module now uses FQCN

* Added package checks for #72

* Reorder task files

  - Docker tasks moved into a separate directory for ease of removal #67
  - Bugfix: Control plane on alternate port didn't work.
  - Validation tasks grouped

* Fix Fedora tests

* Add optional documentation links to validations steps #76

* Removed jmespath requirement

* Fix issue with data collection

* Release candidate
2020-12-21 19:14:52 +00:00
Xan Manning
99c22dceab Uninstall scripts now in-line with upstream
Fixes #74
Addresses #73 - move rancher reference to vars/
2020-12-19 14:05:41 +00:00
Xan Manning
e25edbef3c rework documentation, change github link, replace deprecated variables 2020-12-16 11:02:15 +00:00
Xan Manning
34e2af3d47 Set embedded Etcd as stable, deprecate docker 2020-12-12 14:27:59 +00:00
Xan Manning
4afc2c8a5a Fixed data-dir configuration and draining of nodes. Added documentation. 2020-12-05 21:56:28 +00:00
Xan Manning
21adf94627 Updated issue template and collection yml 2020-11-30 21:57:58 +00:00
Xan Manning
ebf32dbd99 v2 pre-release 2020-11-29 20:10:42 +00:00
Xan Manning
8c791cb611 Change terminology of tasks to remove "master" 2020-11-10 19:01:05 +00:00
Xan Manning
170bf5995f Merge conflict resolved: archlinux support 2020-10-23 16:40:35 +01:00
Xan Manning
35b037c7ee Pre-FQCN breakage 2020-10-23 16:31:21 +01:00
Martin Friedrich
e5133c1f73
add archlinux support, fixed drain invoked on uninstall by adding --delete-local-data 2020-10-23 14:43:58 +02:00
Xan Manning
57b9a2a0be Moved to file based config, pre-FQCN, pre-update to documentation 2020-10-22 19:26:15 +01:00