19 lines
		
	
	
		
			650 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			650 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| # You first need to do a few things on opnsense web interface:
 | |
| # - enable ssh
 | |
| # - create a nationtech user (member of admin) with an API key (system / access /users)
 | |
| # - get an API key / secret
 | |
| 
 | |
| #ansible-galaxy collection install ansible.posix
 | |
| #ansible-galaxy collection install ansibleguy.opnsense
 | |
| 
 | |
| export API_KEY="wQTI+b1VcI2ox3NdB86dySN28TVYusaWUdimFNSMweOeyr++pp6xccPXBBxGoSy9arNhzlTprx5+28IL"
 | |
| export API_SECRET="eOLbAqZkTKMRXEdqjXUdlWLssd7q0bKBt5vNMgPutsc+V2qO4Yh/C9Z1OmBezcuxZdbVCLAjeru1c6zr"
 | |
| 
 | |
| ansible-playbook apiCallTest.yml \
 | |
|   -e API_URL="https://192.168.1.1/api" \
 | |
|   -e API_KEY="${API_KEY}" \
 | |
|   -e API_SECRET="${API_SECRET}"
 | |
| 
 |