diff --git a/deploy/roles/common/handlers/main.yaml b/deploy/roles/common/handlers/main.yaml index 6207454..51ce25e 100644 --- a/deploy/roles/common/handlers/main.yaml +++ b/deploy/roles/common/handlers/main.yaml @@ -1,5 +1,10 @@ --- - name: restart sshd service: name: sshd state: restarted + +- name: restart ntpd + service: + name: ntp + state: restarted diff --git a/deploy/roles/common/tasks/main.yml b/deploy/roles/common/tasks/main.yml index 25a4263..cc240b5 100644 --- a/deploy/roles/common/tasks/main.yml +++ b/deploy/roles/common/tasks/main.yml @@ -1,77 +1,91 @@ --- # Packages - apt: name: "{{ item }}" #update_cache: yes with_items: - htop - iotop - iftop - iperf - screen - vim - tcpdump + - lsof - ntp - qtbase5-dev - emacs-nox # SSH Keys - name: SSH Keys for root authorized_key: user=root key="{{ item }}" with_items: "{{ ssh_keys }}" # Time - copy: content: "Europe/Zurich" dest: "/etc/timezone" - file: state: "link" src: "/usr/share/zoneinfo/Europe/Zurich" dest: "/etc/localtime" +# Time +- name: Enable NTP + service: + name: ntp + enabled: true + state: started + +- lineinfile: + dest: /etc/ntp.conf + line: "server {{ groups.frontal[0] }} prefer" + insertbefore: 'pool 0\.debian\.pool\.ntp\.org iburst' + notify: restart ntpd + when: "'compute' in group_names" # System - hostname: name: "{{ inventory_hostname }}" - replace: path: /etc/ssh/sshd_config regexp: '#HostbasedAuthentication no ' replace: 'HostbasedAuthentication yes' notify: restart sshd tags: ssh - template: src: ssh_know_hosts dest: /etc/ssh/ssh_known_hosts notify: restart sshd tags: ssh - name: Creating some users block: - group: name: "{{ item.key }}" gid: "{{ item.value }}" with_dict: "{{ ids }}" - user: name: spack uid: "{{ ids.spack }}" shell: /bin/bash create_home: yes generate_ssh_key: "{{ 'frontal' in group_names }}" register: user_spack - authorized_key: user=spack key="{{ user_spack.ssh_public_key }}" when: "'frontal' in group_names" - user: name: slurm uid: "{{ ids.slurm }}" system: yes vars: ids: spack: 206 slurm: 204 tags: - users