Add role common
This commit is contained in:
		
							parent
							
								
									c5288bdb4d
								
							
						
					
					
						commit
						e7b0549468
					
				
							
								
								
									
										2
									
								
								common/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								common/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					- name: reload_sysctl
 | 
				
			||||||
 | 
					  command: sysctl --system
 | 
				
			||||||
							
								
								
									
										20
									
								
								common/tasks/aliases.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								common/tasks/aliases.yml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										7
									
								
								common/tasks/main.yml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										20
									
								
								common/tasks/packages.yml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										12
									
								
								common/tasks/ssh.yml
									
									
									
									
									
										Normal 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
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user