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 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 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 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 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 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 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"?