From fff8a16dee7263318ad49835ed1028e31963198e Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Sat, 6 Jun 2020 10:34:10 +0300 Subject: [PATCH 1/8] remove the default hosts.ini file --- inventory/{hosts.ini => hosts.ini.example} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename inventory/{hosts.ini => hosts.ini.example} (100%) diff --git a/inventory/hosts.ini b/inventory/hosts.ini.example similarity index 100% rename from inventory/hosts.ini rename to inventory/hosts.ini.example From 9a1659ad5462d1e6644f68e7743201505b1b67d1 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Sat, 6 Jun 2020 11:45:49 +0300 Subject: [PATCH 2/8] create a sample inventory directory --- inventory/.gitignore | 2 ++ inventory/hosts.ini.example | 12 ------------ inventory/{ => sample}/group_vars/all.yml | 2 +- 3 files changed, 3 insertions(+), 13 deletions(-) create mode 100644 inventory/.gitignore delete mode 100644 inventory/hosts.ini.example rename inventory/{ => sample}/group_vars/all.yml (73%) diff --git a/inventory/.gitignore b/inventory/.gitignore new file mode 100644 index 0000000..cd6c2a9 --- /dev/null +++ b/inventory/.gitignore @@ -0,0 +1,2 @@ +!.gitignore +!sample \ No newline at end of file diff --git a/inventory/hosts.ini.example b/inventory/hosts.ini.example deleted file mode 100644 index b015890..0000000 --- a/inventory/hosts.ini.example +++ /dev/null @@ -1,12 +0,0 @@ -[master] -192.168.1.26 - -[node] -192.168.1.34 -192.168.1.39 -192.168.1.16 -192.168.1.32 - -[k3s_cluster:children] -master -node diff --git a/inventory/group_vars/all.yml b/inventory/sample/group_vars/all.yml similarity index 73% rename from inventory/group_vars/all.yml rename to inventory/sample/group_vars/all.yml index 196170e..ffb33a6 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/sample/group_vars/all.yml @@ -3,4 +3,4 @@ k3s_version: v1.17.5+k3s1 ansible_user: debian systemd_dir: /etc/systemd/system master_ip: "{{ hostvars[groups['master'][0]]['ansible_host'] | default(groups['master'][0]) }}" -extra_server_args: "" +extra_server_args: "--node-taint k3s-controlplane=true:NoExecute" From 6f8118de4db50bd7192347dbec697c3784cd57b7 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Sat, 6 Jun 2020 11:52:12 +0300 Subject: [PATCH 3/8] update the readme file --- .gitignore | 1 - README.md | 12 ++++++++++-- inventory/my-cluster/hosts.ini | 0 inventory/sample/hosts.ini | 12 ++++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 inventory/my-cluster/hosts.ini create mode 100644 inventory/sample/hosts.ini diff --git a/.gitignore b/.gitignore index 788482a..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -hosts.ini diff --git a/README.md b/README.md index e0e617d..710c805 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,13 @@ Master and nodes must have passwordless SSH access ## Usage -Add the system information gathered above into a file called `hosts.ini` in the same directory as this README file. There is a template in the `inventory` directory. For example: +First create a new dirctory based on the `sample` directory within the `inventory` directory: + +```bash +cp -R inventory/sample inventory/my-cluster +``` + +Second, edit `inventory/my-cluster/hosts.ini` to mactch the system information gathered above. For example: ```bash [master] @@ -37,10 +43,12 @@ master node ``` +If needed, you can also edit `inventory/my-cluster/group_vars/all.yml` to match your environment. + Start provisioning of the cluster using the following command: ```bash -ansible-playbook site.yml +ansible-playbook site.yml -i inventory/my-cluster/hosts.ini ``` ## Kubeconfig diff --git a/inventory/my-cluster/hosts.ini b/inventory/my-cluster/hosts.ini new file mode 100644 index 0000000..e69de29 diff --git a/inventory/sample/hosts.ini b/inventory/sample/hosts.ini new file mode 100644 index 0000000..b015890 --- /dev/null +++ b/inventory/sample/hosts.ini @@ -0,0 +1,12 @@ +[master] +192.168.1.26 + +[node] +192.168.1.34 +192.168.1.39 +192.168.1.16 +192.168.1.32 + +[k3s_cluster:children] +master +node From 4fa468b420601295e7724432303680bfd6bc943f Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Sat, 6 Jun 2020 11:52:59 +0300 Subject: [PATCH 4/8] remove the extra_server_args variables --- inventory/sample/group_vars/all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inventory/sample/group_vars/all.yml b/inventory/sample/group_vars/all.yml index ffb33a6..196170e 100644 --- a/inventory/sample/group_vars/all.yml +++ b/inventory/sample/group_vars/all.yml @@ -3,4 +3,4 @@ k3s_version: v1.17.5+k3s1 ansible_user: debian systemd_dir: /etc/systemd/system master_ip: "{{ hostvars[groups['master'][0]]['ansible_host'] | default(groups['master'][0]) }}" -extra_server_args: "--node-taint k3s-controlplane=true:NoExecute" +extra_server_args: "" From f0232e2d7244f26d1d7113ede276a373c97d5654 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Sat, 6 Jun 2020 11:59:40 +0300 Subject: [PATCH 5/8] remove inventory/my-cluster --- inventory/my-cluster/hosts.ini | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 inventory/my-cluster/hosts.ini diff --git a/inventory/my-cluster/hosts.ini b/inventory/my-cluster/hosts.ini deleted file mode 100644 index e69de29..0000000 From 81a96c76d1b66daa82c72926c48d5805f86b641b Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Sat, 6 Jun 2020 12:00:31 +0300 Subject: [PATCH 6/8] update .gitignore --- inventory/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inventory/.gitignore b/inventory/.gitignore index cd6c2a9..edfafe1 100644 --- a/inventory/.gitignore +++ b/inventory/.gitignore @@ -1,2 +1,2 @@ !.gitignore -!sample \ No newline at end of file +!sample/ \ No newline at end of file From 5243733c2bae783392fd5a997cfc013c62f558df Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Sat, 6 Jun 2020 12:01:41 +0300 Subject: [PATCH 7/8] update gitignore correctly --- inventory/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/inventory/.gitignore b/inventory/.gitignore index edfafe1..568d6c0 100644 --- a/inventory/.gitignore +++ b/inventory/.gitignore @@ -1,2 +1,3 @@ +* !.gitignore !sample/ \ No newline at end of file From 7934027318c649c15c37d4fc482388b41542a486 Mon Sep 17 00:00:00 2001 From: Zaher Ghaibeh Date: Sat, 6 Jun 2020 12:05:37 +0300 Subject: [PATCH 8/8] fix typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 710c805..8e3c855 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ Master and nodes must have passwordless SSH access ## Usage -First create a new dirctory based on the `sample` directory within the `inventory` directory: +First create a new directory based on the `sample` directory within the `inventory` directory: ```bash cp -R inventory/sample inventory/my-cluster ``` -Second, edit `inventory/my-cluster/hosts.ini` to mactch the system information gathered above. For example: +Second, edit `inventory/my-cluster/hosts.ini` to match the system information gathered above. For example: ```bash [master]