parent
e992308cf6
commit
216c6e4b8f
11 changed files with 39 additions and 98 deletions
@ -0,0 +1,6 @@ |
||||
--- |
||||
- name: restart chrony |
||||
ansible.builtin.systemd: |
||||
state: restarted |
||||
daemon_reload: yes |
||||
name: chrony |
@ -0,0 +1,27 @@ |
||||
--- |
||||
- name: chrony | 1. Install chrony |
||||
ansible.builtin.apt: |
||||
name: chrony |
||||
state: "{{ chrony_pkg_state }}" |
||||
|
||||
- name: chrony | 2. Create custom chrony directory |
||||
ansible.builtin.file: |
||||
path: "{{ chrony_config_location }}" |
||||
state: directory |
||||
|
||||
- name: chrony | 3. Copy the chrony.conf template file |
||||
ansible.builtin.template: |
||||
src: chrony.conf.j2 |
||||
dest: "{{ chrony_config_location }}" |
||||
notify: |
||||
- restart chrony |
||||
|
||||
- name: chrony | 4. Just force systemd to reread configs |
||||
ansible.builtin.systemd: |
||||
daemon_reload: yes |
||||
|
||||
- name: chrony | 5. start and enable chrony service |
||||
ansible.builtin.service: |
||||
name: "{{ chrony_service_name }}" |
||||
state: "{{ chrony_service_state }}" |
||||
enabled: "{{ chrony_service_enabled }}" |
@ -0,0 +1,5 @@ |
||||
--- |
||||
chrony_service_name: chrony |
||||
chrony_config_location: /etc/sw-chrony/chrony.conf |
||||
chrony_config_driftfile: /var/lib/sw-chrony/chrony.drift |
||||
chrony_config_keyfile: /etc/sw-chrony/chrony.keys |
@ -1,5 +0,0 @@ |
||||
--- |
||||
- 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 |
@ -1,42 +0,0 @@ |
||||
--- |
||||
galaxy_info: |
||||
author: davo |
||||
role_name: chrony |
||||
company: davo |
||||
description: Enables users to install and configure chrony on their hosts. |
||||
license: MIT |
||||
min_ansible_version: 2.4 |
||||
platforms: |
||||
- name: Ubuntu |
||||
versions: |
||||
- artful |
||||
- bionic |
||||
- cosmic |
||||
- cuttlefish |
||||
- disco |
||||
- eoan |
||||
- focal |
||||
- groovy |
||||
- hirsute |
||||
- impish |
||||
- jammy |
||||
- lucid |
||||
- maverick |
||||
- natty |
||||
- precise |
||||
- quantal |
||||
- raring |
||||
- saucy |
||||
- trusty |
||||
- utopic |
||||
- vivid |
||||
- wily |
||||
- xenial |
||||
- yakkety |
||||
- zesty |
||||
galaxy_tags: |
||||
- system |
||||
- chrony |
||||
- ntp |
||||
- time |
||||
dependencies: [] |
@ -1,31 +0,0 @@ |
||||
--- |
||||
- 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: |
||||
src: chrony.conf.j2 |
||||
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 |
@ -1,5 +0,0 @@ |
||||
--- |
||||
- 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 |
@ -1,8 +0,0 @@ |
||||
--- |
||||
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"? |
Loading…
Reference in new issue