Skip to content

Commit

Permalink
Replacing edpm_chrony with linux-systemroles.timesync
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Podivin <[email protected]>
  • Loading branch information
jpodivin committed Oct 25, 2023
1 parent b8b4c3b commit 95eb7c1
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 28 deletions.
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Contents:
usage
roles
plugins
playbooks

Indices and tables
==================
Expand Down
9 changes: 9 additions & 0 deletions docs/source/playbooks.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Playbooks in EDPM-Ansible
=========================

Contents:

.. toctree::
:glob:

playbooks/*
22 changes: 22 additions & 0 deletions docs/source/playbooks/install_os.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
=====================
Playbook - install_os
=====================

Installs services necessary for the EDPM operation.
Uses external `timesync` role from `system roles collection`_ to both install and configure chrony.

--------------------------
Time service configuration
--------------------------

Variables of the `timesync`_ system role can be overriden in a standard ansible way,
while respecting resolution order. Default values are set in the `install_os` playbook,
while allowing for override.

Following variables are exposed as parameters for deployment tools.

* edpm_timesync_step_threshold - corresponding to the `timesync_step_threshold` of the role
* edpm_ntp_servers - corresponding to the `timesync_ntp_servers` of the role.

.. _`system roles collection`: https://linux-system-roles.github.io/
.. _`timesync`: https://github.com/linux-system-roles/timesync
6 changes: 0 additions & 6 deletions playbooks/configure_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
tasks_from: configure.yml
tags:
- edpm_sshd
- name: Configure edpm_chrony
ansible.builtin.import_role:
name: osp.edpm.edpm_chrony
tasks_from: config.yml
tags:
- edpm_chrony
- name: Configure edpm_timezone
ansible.builtin.import_role:
name: osp.edpm.edpm_timezone
Expand Down
29 changes: 25 additions & 4 deletions playbooks/install_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
hosts: all
strategy: linear
become: true
vars:
ntp_servers: #TODO(jpodivin) Simplify conditional once the consumer projects are adjusted
"{%- if edpm_chrony_ntp_servers is defined -%}
{{ edpm_chrony_ntp_servers }} {%- else -%}
edpm_ntp_servers {%- endif -%}"
timesync_step_threshold: "{{ edpm_timesync_step_threshold | default(1.0) }}"
tasks:
- name: Install edpm_podman
ansible.builtin.import_role:
Expand All @@ -17,10 +23,25 @@
tasks_from: install.yml
tags:
- edpm_sshd
- name: Install edpm_chrony
ansible.builtin.import_role:
name: osp.edpm.edpm_chrony
tasks_from: install.yml
- name: Set FQCN for the timesync role
ansible.builtin.set_fact:
timesyncfqn:
"{%- if ansible_facts['distribution'] == 'RedHat' -%}
redhat.rhel{%- else -%}
fedora.linux{%- endif -%}
_system_roles.timesync"
delegate_to: localhost
- name: Compile list of ntp servers with their attributes
ansible.builtin.set_fact:
timesync_ntp_servers: "{{ timesync_ntp_servers | default([]) + [{ 'hostname' : item }]}}"
loop: "{{ timesync_ntp_servers }}"
when: item is string
failed_when: >
( item is mapping ) and
( 'hostname' not in item )
- name: Install and configure time service using timesync system role
ansible.builtin.include_role:
name: "{{ timesyncfqn }}"
tags:
- edpm_chrony
- name: Install edpm_logrotate_crond
Expand Down
18 changes: 0 additions & 18 deletions playbooks/run_os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,6 @@
tasks_from: run.yml
tags:
- edpm_sshd
- name: Run edpm_chrony
ansible.builtin.import_role:
name: osp.edpm.edpm_chrony
tasks_from: run.yml
tags:
- edpm_chrony
- name: Run edpm_chrony (Online)
ansible.builtin.import_role:
name: osp.edpm.edpm_chrony
tasks_from: online.yml
tags:
- edpm_chrony
- name: Run edpm_chrony (Sync)
ansible.builtin.import_role:
name: osp.edpm.edpm_chrony
tasks_from: sync.yml
tags:
- edpm_chrony
- name: Run edpm_timezone
ansible.builtin.import_role:
name: osp.edpm.edpm_timezone
Expand Down

0 comments on commit 95eb7c1

Please sign in to comment.