diff --git a/docs/source/index.rst b/docs/source/index.rst index 0a5f9cd31..a4e65fb9f 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -16,6 +16,7 @@ Contents: usage roles plugins + playbooks Indices and tables ================== diff --git a/docs/source/playbooks.rst b/docs/source/playbooks.rst new file mode 100644 index 000000000..63d1d554a --- /dev/null +++ b/docs/source/playbooks.rst @@ -0,0 +1,9 @@ +Playbooks in EDPM-Ansible +========================= + +Contents: + +.. toctree:: + :glob: + + playbooks/* diff --git a/docs/source/playbooks/install_os.rst b/docs/source/playbooks/install_os.rst new file mode 100644 index 000000000..ddf248bd1 --- /dev/null +++ b/docs/source/playbooks/install_os.rst @@ -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 diff --git a/playbooks/configure_os.yml b/playbooks/configure_os.yml index f79818fd1..316662e3a 100644 --- a/playbooks/configure_os.yml +++ b/playbooks/configure_os.yml @@ -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 diff --git a/playbooks/install_os.yml b/playbooks/install_os.yml index 2bc93c636..3be369666 100644 --- a/playbooks/install_os.yml +++ b/playbooks/install_os.yml @@ -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: @@ -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 diff --git a/playbooks/run_os.yml b/playbooks/run_os.yml index f8c8bdb77..5f1973efd 100644 --- a/playbooks/run_os.yml +++ b/playbooks/run_os.yml @@ -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