From 2c2f725902e33ec9ab7c0711a139e21f2c5b99de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Lipov=C4=8Dan?= Date: Wed, 27 Jul 2022 06:01:42 +0200 Subject: [PATCH 1/7] Add readme for easier navigation --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..dcbfd3b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# TODO +- Add readme, as it is always needed. Who knows who will want to use this role? +- - At least: 1) Basic description 2) Important variables 3) Detailed info 4) Playbook example 5) Don't forget to mention other role dependencies From e5adb70c43b2dea9265b66cb603f753de9409bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Lipov=C4=8Dan?= Date: Wed, 27 Jul 2022 06:03:30 +0200 Subject: [PATCH 2/7] Naming --- chrony.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrony.yml b/chrony.yml index b332cbc..7f0569f 100644 --- a/chrony.yml +++ b/chrony.yml @@ -9,4 +9,5 @@ - name: 2. Gather facts setup: # aka gather_facts roles: - - chrony + - chrony #naming scheme - in large repo, use sw prefix when desgning a role for software "sw-chrony" or in standalone + # role like this one, use "ansible-chrony" to let the user know that this is in a fact an Ansible role From d357c4bf1b5f6b13dddd80f930d883644d642d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Lipov=C4=8Dan?= Date: Wed, 27 Jul 2022 06:05:18 +0200 Subject: [PATCH 3/7] Handlers syntax --- chrony/handlers/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrony/handlers/main.yml b/chrony/handlers/main.yml index a917f78..f885a8f 100644 --- a/chrony/handlers/main.yml +++ b/chrony/handlers/main.yml @@ -1,3 +1,5 @@ --- - name: restart chrony service: name={{ chrony_service_name }} state=restarted + +#use newer style of ansible syntax - https://docs.ansible.com/ansible/latest/collections/ansible/builtin/systemd_module.html#examples From c3e509bf2ab65d1a2e691a91a47696f3a0c0e77c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Lipov=C4=8Dan?= Date: Wed, 27 Jul 2022 06:09:02 +0200 Subject: [PATCH 4/7] Chrony tasks review --- chrony/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chrony/tasks/main.yml b/chrony/tasks/main.yml index f7094a5..91e108e 100644 --- a/chrony/tasks/main.yml +++ b/chrony/tasks/main.yml @@ -1,9 +1,16 @@ --- - name: chrony | Add the OS specific variables include_vars: "ubuntu.yml" + # designujes roli pro jeden OS (nemas tam specificke vars pro rhel nebo centos) + # zjednodus to, misto include vars ubuntu.yml z vars slozky toto vypust a dej do vars slozky jen "main.yml", kde to vydefinujes + # ansible si to tak natahne by default a nemusis resit - name: chrony | Installation include_tasks: "ubuntu.yml" + + # fajn ze to je oddelene pres include tasks, ale dalsi veci si neoddelil why? + # ten template a ta service by mohla byt v chrony-setup.yml a misto ubuntu.yml by si to mohl pojmenovat jako install.yml (protoze opet nemas OS-specific + # instalacni postupy, delame jen na ubuntu - name: chrony | Copy the chrony.conf template file template: @@ -11,9 +18,14 @@ dest: "{{ chrony_config_location }}" notify: - restart chrony + + # je dobry kvuli debugu a prehlednosti pojmenovat tasky i cislem od 1. a dale + # hodi se to kdyz poustis ansible, ze hnedka vidis roli + cislo, kde to dela problem - name: chrony | start and enable chrony service service: name: "{{ chrony_service_name }}" state: "{{ chrony_service_state }}" enabled: "{{ chrony_service_enabled }}" + + # daemon reload neni treba? nebo jo? rekni proc From f60bb87ae414f97818c2028522af1fbcf1aeed37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Lipov=C4=8Dan?= Date: Wed, 27 Jul 2022 06:09:27 +0200 Subject: [PATCH 5/7] apt module --- chrony/tasks/ubuntu.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrony/tasks/ubuntu.yml b/chrony/tasks/ubuntu.yml index 6049560..119c823 100644 --- a/chrony/tasks/ubuntu.yml +++ b/chrony/tasks/ubuntu.yml @@ -1,3 +1,5 @@ --- - name: Install the require packages in Ubuntu derivatives apt: name=chrony state={{ chrony_pkg_state }} + +# again old syntax, look up ansible apt module a opis to z toho From 6e42031bd33397d4d0d9de0d92a03221a0f725cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Lipov=C4=8Dan?= Date: Wed, 27 Jul 2022 06:11:13 +0200 Subject: [PATCH 6/7] Chrony jinja cr --- chrony/templates/chrony.conf.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chrony/templates/chrony.conf.j2 b/chrony/templates/chrony.conf.j2 index 85ea208..da2e0b5 100644 --- a/chrony/templates/chrony.conf.j2 +++ b/chrony/templates/chrony.conf.j2 @@ -37,3 +37,9 @@ makestep 1 3 {% for k, v in chrony_config_extra_options.items() %} {{ k }} {{ v }} {% endfor %} + + +# popis mi plz, co tenhle cyklus udela v sablone pro nasledujici promenne (nad obsahem tech options se nezamyslej, ty jsem si vymyslel): +# chrony_config_extra_options: +# - time_server: ntp.davo.cz +# - follow_drift: yes From 9838df4204a8e9decb09485c1dfef43ed6915dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Lipov=C4=8Dan?= Date: Wed, 27 Jul 2022 06:11:51 +0200 Subject: [PATCH 7/7] Chrony vars cr --- chrony/vars/ubuntu.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chrony/vars/ubuntu.yml b/chrony/vars/ubuntu.yml index 8cd6485..50018ee 100644 --- a/chrony/vars/ubuntu.yml +++ b/chrony/vars/ubuntu.yml @@ -3,3 +3,6 @@ chrony_service_name: chrony chrony_config_location: /etc/chrony/chrony.conf chrony_config_driftfile: /var/lib/chrony/chrony.drift chrony_config_keyfile: /etc/chrony/chrony.keys + + +# proc myslis, ze je dobry/neni dobry to mit pojmenovane vse s prefixem "chrony"?