ansible: deploy ssh keys correctly, mount NFS
This commit is contained in:
		
					parent
					
						
							
								539772c1e5
							
						
					
				
			
			
				commit
				
					
						cf32701bcd
					
				
			
		
					 2 changed files with 29 additions and 0 deletions
				
			
		| 
						 | 
					@ -1,5 +1,25 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					# Cannot use the standard, hosts use /etc/ssh/keys/%u
 | 
				
			||||||
 | 
					# - name: Add SSH public keys
 | 
				
			||||||
 | 
					#   authorized_key:
 | 
				
			||||||
 | 
					#     user: "nschottelius"
 | 
				
			||||||
 | 
					#     state: present
 | 
				
			||||||
 | 
					#     key: "{{ item }}"
 | 
				
			||||||
 | 
					#   with_items: "{{ ssh_keys }}"
 | 
				
			||||||
 | 
					#   tags:
 | 
				
			||||||
 | 
					#     - base
 | 
				
			||||||
 | 
					#     - ssh
 | 
				
			||||||
- name: Add SSH public keys
 | 
					- name: Add SSH public keys
 | 
				
			||||||
 | 
					  ansible.builtin.template:
 | 
				
			||||||
 | 
					    src: authorized_keys.j2
 | 
				
			||||||
 | 
					    dest: /etc/ssh/keys/{{ ansible_user }}
 | 
				
			||||||
 | 
					    owner: root
 | 
				
			||||||
 | 
					    group: root
 | 
				
			||||||
 | 
					    mode: '0444'
 | 
				
			||||||
 | 
					  tags:
 | 
				
			||||||
 | 
					    - ssh
 | 
				
			||||||
 | 
					    - base
 | 
				
			||||||
 | 
					- name:
 | 
				
			||||||
  authorized_key:
 | 
					  authorized_key:
 | 
				
			||||||
    user: "nschottelius"
 | 
					    user: "nschottelius"
 | 
				
			||||||
    state: present
 | 
					    state: present
 | 
				
			||||||
| 
						 | 
					@ -8,3 +28,9 @@
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
    - base
 | 
					    - base
 | 
				
			||||||
    - ssh
 | 
					    - ssh
 | 
				
			||||||
 | 
					- name: Mount data NFS volume
 | 
				
			||||||
 | 
					  ansible.posix.mount:
 | 
				
			||||||
 | 
					    src: 10.165.71.1:/mtx_syna_lat_internal_ru
 | 
				
			||||||
 | 
					    path: /mnt
 | 
				
			||||||
 | 
					    state: mounted
 | 
				
			||||||
 | 
					    fstype: nfs
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										3
									
								
								ansible/roles/base/templates/authorized_keys.j2
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								ansible/roles/base/templates/authorized_keys.j2
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					{% for item in ssh_keys %}
 | 
				
			||||||
 | 
					{{ item }}
 | 
				
			||||||
 | 
					{% endfor %}
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue