mirror of
				https://github.com/gjkcz/ansible-void.git
				synced 2025-11-04 03:50:26 +01:00 
			
		
		
		
	Create role for SSH
This commit is contained in:
		
							
								
								
									
										3
									
								
								roles/ssh/defaults/main.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								roles/ssh/defaults/main.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
ssh_user: root
 | 
			
		||||
ssh_dir: /root/.ssh
 | 
			
		||||
ssh_keys: []
 | 
			
		||||
							
								
								
									
										14
									
								
								roles/ssh/tasks/main.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								roles/ssh/tasks/main.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
- name: Ensure SSH directory exists
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ ssh_dir }}"
 | 
			
		||||
    state: directory
 | 
			
		||||
    owner: "{{ ssh_user }}"
 | 
			
		||||
    group: "{{ ssh_user }}"
 | 
			
		||||
    mode: 0700
 | 
			
		||||
 | 
			
		||||
- name: Import SSH keys
 | 
			
		||||
  authorized_key:
 | 
			
		||||
    user: "{{ ssh_user }}"
 | 
			
		||||
    key: "{{ item }}"
 | 
			
		||||
    state: present
 | 
			
		||||
  loop: "{{ ssh_keys }}"
 | 
			
		||||
		Reference in New Issue
	
	Block a user