diff --git a/deploy/hosts b/deploy/hosts index 3ed8e18..1502ca6 100644 --- a/deploy/hosts +++ b/deploy/hosts @@ -1,12 +1,12 @@ [compute] r01-n01.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:0d:6c controller=True r01-n02.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:0d:e3 r01-n03.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:27:86 r01-n04.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:25:e2 r02-n01.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:25:ef controller=True r02-n02.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:24:f8 -r02-n03.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:22:90 -r02-n04.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:27:b1 +r02-n03.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:27:b1 +r02-n04.agamemnon.hpc.epfl.ch hwaddr=00:1e:06:33:22:90 [frontal] -agamemnon.agamemnon.hpc.epfl.ch \ No newline at end of file +agamemnon.agamemnon.hpc.epfl.ch diff --git a/deploy/roles/common/tasks/main.yml b/deploy/roles/common/tasks/main.yml index cc240b5..4ea3128 100644 --- a/deploy/roles/common/tasks/main.yml +++ b/deploy/roles/common/tasks/main.yml @@ -1,91 +1,91 @@ --- # Packages - apt: name: "{{ item }}" - #update_cache: yes + 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 diff --git a/deploy/roles/first_deploy/tasks/main.yml b/deploy/roles/first_deploy/tasks/main.yml index 686272e..3daeb26 100644 --- a/deploy/roles/first_deploy/tasks/main.yml +++ b/deploy/roles/first_deploy/tasks/main.yml @@ -1,45 +1,44 @@ --- - name: first boot and deploy keys block: - shell: | spawn -noecho ssh -q -o StrictHostKeyChecking=no root@{{ inventory_hostname }} expect "password: " - send {{ armbian_default_pass }}\n + send "{{ armbian_default_pass }}\n" expect { "(current) UNIX password: " { - send {{ armbian_default_pass }}\n + send "{{ armbian_default_pass }}\n" exp_continue } "Enter new UNIX password: " { - send {{ armbian_new_pass }}\n + send "{{ armbian_new_pass }}\n" exp_continue } "Retype new UNIX password: " { - send {{ armbian_new_pass }}\n + send "{{ armbian_new_pass }}\n" exp_continue } "Please provide a username (eg. your forename): " { #send odroidc2\n - send \003 + send "\003" exp_continue } } close - exit 0 args: executable: /usr/bin/expect - creates: .first_boot_done + creates: /root/.first_boot_done_{{ inventory_hostname_short }} delegate_to: "{{ groups['frontal'][0] }}" - authorized_key: user=root key="{{ item }}" with_items: "{{ ssh_keys }}" vars: ansible_ssh_pass: odroidc2 ansible_ssh_extra_args: "-o StrictHostKeyChecking=no -o PubkeyAuthentication=no" always: - meta: clear_host_errors tags: - first diff --git a/deploy/roles/frontal/tasks/main.yaml b/deploy/roles/frontal/tasks/main.yaml index ea10251..92efd08 100644 --- a/deploy/roles/frontal/tasks/main.yaml +++ b/deploy/roles/frontal/tasks/main.yaml @@ -1,64 +1,63 @@ --- - apt: name: "{{ item }}" update_cache: yes with_items: - expect tags: - packages - first - name: Packages block: - apt: name: "{{ item }}" - update_cache: yes with_items: - bash-completion - dnsmasq - iptables-persistent - acl - git - ansible - binutils - make - man-db - locales - debconf: name: locales question: locales/locales_to_be_generated value: en_US.UTF-8 UTF-8 vtype: multiselect tags: - packages - name: Setting config files block: - copy: src: "etc/{{ item }}" dest: /etc/ with_items: - dhcp - modprobe.d - network - iptables - hosts - sysctl: name: net.ipv4.ip_forward value: 1 sysctl_set: yes state: present reload: yes - copy: src: boot/firmware/cmdline.txt dest: /boot/firmware/cmdline.txt - template: src: etc/ethers dest: /etc/ethers mode: 0644 notify: restart dnsmasq - copy: src: etc/dnsmasq.d dest: /etc/ notify: restart dnsmasq