diff --git a/common/handlers/main.yml b/common/handlers/main.yml new file mode 100644 index 0000000..7ee7465 --- /dev/null +++ b/common/handlers/main.yml @@ -0,0 +1,2 @@ +- name: reload_sysctl + command: sysctl --system diff --git a/common/tasks/aliases.yml b/common/tasks/aliases.yml new file mode 100644 index 0000000..0cd19e3 --- /dev/null +++ b/common/tasks/aliases.yml @@ -0,0 +1,20 @@ +- name: General aliases + blockinfile: + path: "{{ ansible_facts.env.HOME }}/.bashrc" + marker: "# {mark} ANSIBLE MANAGED BLOCK | General aliases" + block: | + alias clr="clear" + alias hgrep="history | grep" + alias syslog="tail -f --lines=100 /var/log/syslog" + alias cp="rsync -hlAXEptgoDS --numeric-ids --info=progress2" + +- name: ls aliases and colors + blockinfile: + path: "{{ ansible_facts.env.HOME }}/.bashrc" + marker: "# {mark} ANSIBLE MANAGED BLOCK | ls aliases and colors" + block: | + export LS_OPTIONS='--color=auto' + eval "`dircolors`" + alias ls='ls $LS_OPTIONS' + alias ll='ls $LS_OPTIONS -l' + alias l='ls $LS_OPTIONS -la' diff --git a/common/tasks/main.yml b/common/tasks/main.yml new file mode 100644 index 0000000..e12de46 --- /dev/null +++ b/common/tasks/main.yml @@ -0,0 +1,7 @@ +- import_tasks: ./packages.yml + +- import_tasks: ./ssh.yml + +- import_tasks: ./packages.yml + +- import_tasks: ./aliases.yml diff --git a/common/tasks/packages.yml b/common/tasks/packages.yml new file mode 100644 index 0000000..2313f48 --- /dev/null +++ b/common/tasks/packages.yml @@ -0,0 +1,20 @@ +- name: Update Packages + apt: + update_cache: yes + upgrade: yes + when: ansible_facts.distribution == "Debian" + +- name: Install Packages + package: + name: + - gpg + - htop + - iotop + - slurm + - sudo + - screen + - curl + - rsync + - zstd + state: latest + when: ansible_facts.distribution == "Debian" diff --git a/common/tasks/ssh.yml b/common/tasks/ssh.yml new file mode 100644 index 0000000..a3671d2 --- /dev/null +++ b/common/tasks/ssh.yml @@ -0,0 +1,12 @@ +- name: Disable SSH password auth + lineinfile: + dest: /etc/ssh/sshd_config + regexp: '^PasswordAuthentication\s*yes' + line: "PasswordAuthentication no" + register: sshd_config + +- name: Restart SSH daemon + service: + name: sshd + state: restarted + when: sshd_config.changed