diff --git a/defaults/main.yml b/defaults/main.yml index 6d6f78b..b3220f4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,27 +15,32 @@ perfsonar_optional_packages: - perfsonar-toolkit-sysctl - perfsonar-toolkit-systemenv-testpoint +# You can change the default variables for different platforms to which clock synchronization service to use. +# Recognized options are { ntpd ,chrony } +timesync: ntpd + # List of NTP servers you want to use on your perfSONAR hosts # If empty, any already configured NTP server will not be changed # If you also install the 'perfsonar-toolkit-ntp' package below, the perfSONAR # provided script will choose the closest NTP servers for you. perfsonar_ntp_servers: [] -#perfsonar_ntp_servers: + +#perfsonar_ntp_servers: # - { name: "NTP 1", hostname: ntp.switch.ch } # - { name: "NTP 2", hostname: 0.ch.pool.ntp.org } # - { name: "NTP 3", hostname: 1.ch.pool.ntp.org } # - { name: "NTP 4", hostname: 2.ch.pool.ntp.org } # - { name: "NTP 5", hostname: 3.ch.pool.ntp.org } -# You can change the default variables for different platforms to which clock synchronization service to use. -# You can use chrony/chronyd instead of ntp - -timesync_service: - Debian: ntp - RedHat: ntpd - default: ntp - -ntp_service: "{{ timesync_service[ansible_os_family] | default(timesync_service['default']) }}" +#Delete# # You can change the default variables for different platforms to which clock synchronization service to use. +#Delete# # You can use chrony/chronyd instead of ntp +#Delete# +#Delete# timesync_service: +#Delete# Debian: ntp +#Delete# RedHat: ntpd +#Delete# default: ntp +#Delete# +#Delete# ntp_service: "{{ timesync_service[ansible_os_family] | default(timesync_service['default']) }}" # Disable ssh root access perfsonar_disable_root_ssh: True diff --git a/handlers/main.yml b/handlers/main.yml index fa8b2d1..31facda 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,12 +1,12 @@ --- # handlers file for perfsonar-testpoint -- name: restart ntp +- name: SvcRestart TimeSync service: - name: "{{ ntp_service }}" + name: "{{ timesync_service }}" state: restarted -- name: restart ssh +- name: SvcRestart SSH service: name: "{{ ssh_service }}" state: restarted diff --git a/tasks/main.yml b/tasks/main.yml index 34f4d4b..3f8e481 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,7 +8,7 @@ - name: Gather facts to load OS information tags: [ 'ps::install', 'ps::running', 'ps::config' ] setup: - become: no + become: false - name: Load variables based on OS type tags: [ 'ps::install', 'ps::running', 'ps::config' ] @@ -18,6 +18,17 @@ - "{{ ansible_distribution }}.yml" - "{{ ansible_os_family }}.yml" + +##### +# Install of additional packages: ps::install tag +##### + +- name: Install Time Synchronization Service + tags: [ 'ps::install' ] + package: + name: "{{ timesynchash[timesync][ansible_os_family]['pkg'] }}" + state: latest + ##### # Configuration part: ps::config tag ##### @@ -30,16 +41,19 @@ regexp: '127\.0\..*[\s]+{{ ansible_fqdn }}[\s]+.*' # NTP is essential for good measurements -- name: Configure additional NTP servers +# Issue (item=chrony) => {"ansible_loop_var": "item", "changed": false, "item": "chrony", "msg": "Unable to start service chrony: Failed to start chrony.service: Unit chrony.service is masked.\n"} +# Solution remove package ntpd + +- name: Configure additional Time servers tags: [ 'ps::config' ] blockinfile: - path: /etc/ntp.conf + path: "{{ timesynchash[timesync][ansible_os_family]['cfg'] }}" block: | server {{ item.hostname }} iburst marker: "# {mark} ansible-role-perfsonar {{ item.name }}" with_items: "{{ perfsonar_ntp_servers }}" notify: - - restart ntp + - SvcRestart TimeSync - name: Disable ssh root access tags: [ 'ps::config' ] @@ -50,7 +64,7 @@ line: "PermitRootLogin no" when: perfsonar_disable_root_ssh notify: - - restart ssh + - SvcRestart SSH - name: Configure LS registration tags: [ 'ps::config' ] @@ -62,14 +76,14 @@ tags: [ 'ps::config' ] shell: psconfig remote list --agent pscheduler | tail -n +2 | jq -r .[].url register: psconfig_remotes - changed_when: False + changed_when: false # And list of configured remotes with archiving - name: Look at current psconfig remote list with configured archives tags: [ 'ps::config' ] shell: psconfig remote list --agent pscheduler | tail -n +2 | jq -r '.[] | select(."configure-archives"==true) | .url' register: psconfig_remotes_archives - changed_when: False + changed_when: false # The 2 lists are used in psconfig_remotes.yml - name: add/delete remote mesh configurations that have a valid URL and state @@ -87,6 +101,7 @@ loop_control: loop_var: auth_interface + ##### # Verifying part: ps::running tag ##### @@ -104,8 +119,8 @@ name: "{{ item }}" state: started with_flattened: - - "{{ perfsonar_services }}" - - "{{ perfsonar_os_specific_services }}" + - "{{ perfsonar_services }}" + - "{{ perfsonar_os_specific_services }}" # Get some useful info out of the system - name: Check system status @@ -119,7 +134,7 @@ register: pscheduler_troubleshoot until: pscheduler_troubleshoot is succeeded retries: 3 - changed_when: False + changed_when: false - name: Report pscheduler troubleshoot output tags: [ 'ps::running', 'ps::monitor' ] @@ -127,4 +142,3 @@ msg: - "{{ pscheduler_troubleshoot.stdout.replace('\n\n','\n').split('\n') }}" when: pscheduler_troubleshoot is defined - diff --git a/vars/Debian.yml b/vars/Debian.yml index 48cdd1d..fec7651 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,10 +1,10 @@ # variables specific to Debian OS family --- -# Default NTP service name: ntp # List of perfSONAR services to check are running on Debian hosts perfsonar_testpoint_os_specific_services: - apache2 - postgresql + - "{{ timesync_service }}" perfsonar_toolkit_config_daemon: perfsonar-toolkit-config-daemon diff --git a/vars/RedHat.yml b/vars/RedHat.yml index d27b8b0..aedc5be 100644 --- a/vars/RedHat.yml +++ b/vars/RedHat.yml @@ -6,5 +6,6 @@ perfsonar_testpoint_os_specific_services: - httpd - postgresql-10 + - "{{ timesync_service }}" perfsonar_toolkit_config_daemon: perfsonar-configdaemon diff --git a/vars/main.yml b/vars/main.yml index 2b125c0..ccb32bb 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -4,9 +4,34 @@ # This means they cannot be overwritten in inventory or playbook. # See http://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable +# stays here, so that noone can just overwrite it +#Time synchronization #TODO +timesynchash: + chrony: + Debian: + pkg: chrony + svc: chrony + cfg: /etc/chrony/chrony.conf + RedHat: + pkg: chrony + svc: chronyd + cfg: /etc/chrony.conf + ntpd: + Debian: + pkg: ntp + svc: ntpd + cfg: /etc/ntp.conf + RedHat: + pkg: ntp + svc: ntpd + cfg: /etc/ntp.conf + # SSH daemon service ssh_service: sshd +# Time Sync service +timesync_service: "{{ timesynchash[timesync][ansible_os_family]['svc'] }}" + # List of perfSONAR services to check are running on a testpoint install perfsonar_testpoint_services: - pscheduler-scheduler