Commit Graph

283 Commits

Author SHA1 Message Date
Xan Manning
e90448f40b Updated systemd template to use token when joining a cluster 2021-07-24 17:21:31 +01:00
Xan Manning
4e713918a7 Version bump 2021-07-21 20:34:10 +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
Xan Manning
d2968d5f42
Merge pull request #135 from Yajo/fix-jinja2-native
fix: restore clustering and avoid failure with jinja2_native=true
2021-07-21 20:28: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
Xan Manning
0c084531d2
Merge pull request #133 from Yajo/patch-1
fix: typo
2021-07-16 20:24:53 +01:00
Jairo Llopis
b8539cd82e fix: typo 2021-07-16 09:21:55 +00:00
Xan Manning
2da5738452 Updated README with current k3s supported OS 2021-06-22 20:39:38 +01:00
Xan Manning
8dab5e6f26 Bumped up Ansible version for testing 2021-06-22 20:29:49 +01:00
Xan Manning
7607bfb7a9 Updated test images 2021-06-22 20:28:23 +01:00
Xan Manning
f46450319b Update changelog 2021-05-30 21:05:03 +01:00
Xan Manning
10d11c63ec
Merge pull request #126 from mrobinsn/main
Case insensitive control node lookup
2021-05-30 21:00:45 +01: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
Xan Manning
e5b9e5a78a Updated CHANGELOG and molecule tests 2021-05-27 18:13:55 +00:00
Xan Manning
c36c026783
Merge pull request #124 from onedr0p/manifest-urls
feat: add support for specifying URLs in templates
2021-05-27 17:55:56 +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
b7210af4e9
fix: update README 2021-05-26 18:11:12 -04:00
Devin Buhl
2e629838f1
feat: add support for specifying URLs in templates 2021-05-26 18:07:22 -04:00
Xan Manning
7f0eb60a14
Merge pull request #120 from bjw-s/staticpods
Allow control plane static pods
2021-05-26 18:05:25 +01:00
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs
32c68ea949
Update README.md 2021-05-26 13:38:00 +02:00
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs
d834ca15b0
Merge branch 'main' into staticpods 2021-05-26 09:57:58 +02:00
Xan Manning
6bff9b9981
Merge pull request #119 from onedr0p/patch-1
fix: only deploy templates on primary controller
2021-05-26 08:54:38 +01: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
ᗪєνιη ᗷυнʟ
07fe0e2964
fix: update readme 2021-05-25 18:43:32 -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
Xan Manning
4d5d5b2838 Updated documentation to remove deprecated playbook structures #115 2021-05-15 18:47:27 +01:00
Xan Manning
7bb9f6d8b4 Update changelog 2021-05-13 18:19:55 +01:00
Xan Manning
f220fce08f Version-compare test 2021-05-13 17:43:29 +01:00
Xan Manning
2b7fd373f0
Merge pull request #114 from anjia0532/k3s_private_registry
Support k3s private registry configuration
2021-05-13 16:56:23 +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
赵安家
21fa8b048f build(gitignore): modify .gitignore
added .idea dir to .gitignore file
2021-05-07 17:55:56 +08:00
Xan Manning
a298ea0985 Update CHANGELOG.md 2021-05-06 21:11:04 +01:00
Xan Manning
ea03eaa9dd
Merge pull request #113 from angelnu/patch-1
Unmount CSI plugin folder to avoid data lost on uninstall
2021-05-06 18:52:52 +01:00
Vegetto
5305eb3758
Unmount CSI plugin folder
Fixed upstream - see https://github.com/k3s-io/k3s/issues/3264
2021-05-04 23:20:46 +02:00
Xan Manning
87c56dbe64 Updated CHANGELOG 2021-05-01 08:53:11 +01:00
Xan Manning
d2ca503432
Merge pull request #112 from anjia0532/fix_kubectl_get_nodes_result_stdout_error
fixed kubectl_get_nodes_result.stdout error
2021-04-30 17:34:25 +01: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
2432a7d25f Fix autodeploy test 2021-04-18 20:46:31 +01: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
60da06e137
Merge pull request #110 from bdronneau/patch-1
docs(readme): typo on ansible
2021-04-18 16:12:14 +01:00