Merge branch 'role_common'

This commit is contained in:
Ruakij 2022-10-27 00:27:32 +02:00
commit 657f861696
5 changed files with 61 additions and 0 deletions

2
common/handlers/main.yml Normal file
View File

@ -0,0 +1,2 @@
- name: reload_sysctl
command: sysctl --system

20
common/tasks/aliases.yml Normal file
View File

@ -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'

7
common/tasks/main.yml Normal file
View File

@ -0,0 +1,7 @@
- import_tasks: ./packages.yml
- import_tasks: ./ssh.yml
- import_tasks: ./packages.yml
- import_tasks: ./aliases.yml

20
common/tasks/packages.yml Normal file
View File

@ -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"

12
common/tasks/ssh.yml Normal file
View File

@ -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