First
This commit is contained in:
		
							
								
								
									
										29
									
								
								.travis.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								.travis.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | |||||||
|  | --- | ||||||
|  | language: python | ||||||
|  | python: "2.7" | ||||||
|  |  | ||||||
|  | # Use the new container infrastructure | ||||||
|  | sudo: false | ||||||
|  |  | ||||||
|  | # Install ansible | ||||||
|  | addons: | ||||||
|  |   apt: | ||||||
|  |     packages: | ||||||
|  |     - python-pip | ||||||
|  |  | ||||||
|  | install: | ||||||
|  |   # Install ansible | ||||||
|  |   - pip install ansible | ||||||
|  |  | ||||||
|  |   # Check ansible version | ||||||
|  |   - ansible --version | ||||||
|  |  | ||||||
|  |   # Create ansible.cfg with correct roles_path | ||||||
|  |   - printf '[defaults]\nroles_path=../' >ansible.cfg | ||||||
|  |  | ||||||
|  | script: | ||||||
|  |   # Basic role syntax check | ||||||
|  |   - ansible-playbook tests/test.yml -i tests/inventory --syntax-check | ||||||
|  |  | ||||||
|  | notifications: | ||||||
|  |   webhooks: https://galaxy.ansible.com/api/v1/notifications/ | ||||||
							
								
								
									
										54
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,54 @@ | |||||||
|  | Endlessh-Go | ||||||
|  | ========= | ||||||
|  |  | ||||||
|  | Installs the go version of Endlessh and opens firewalld ports (see defaults). | ||||||
|  | It listens to the port 22 for ssh, and 2112 for prometheus. These can't be changed simply unfortunately, but you can modifiy the /etc/systemd/systemd/endlessh-go.service file after install to suit your needs (juste do a systemctl daemon-reload && systemctl restart endlessh-go afterwards). | ||||||
|  |  | ||||||
|  | The corresponding Grafana dashboard is [here](https://grafana.com/grafana/dashboards/15156). | ||||||
|  |  | ||||||
|  | An example of prometheus config for this service is: | ||||||
|  | ```yaml | ||||||
|  |  | ||||||
|  | scrape_configs: | ||||||
|  |   - job_name: 'endlessh' | ||||||
|  |     scrape_interval: 60s | ||||||
|  |     static_configs: | ||||||
|  |       - targets: ['endlessh:2112'] | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | Requirements | ||||||
|  | ------------ | ||||||
|  |  | ||||||
|  | None, if firewalld is not installed we do not open ports. | ||||||
|  |  | ||||||
|  | Role Variables | ||||||
|  | -------------- | ||||||
|  |  | ||||||
|  | * Ports to open : see defaults. These ports will be opened in firewalld. | ||||||
|  | ```yaml | ||||||
|  | fwd_ports: | ||||||
|  |       prom: | ||||||
|  |         zone: home | ||||||
|  |         port: 2112/tcp | ||||||
|  |       ssh: | ||||||
|  |         zone: public | ||||||
|  |         port: 22/tcp | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  |  | ||||||
|  | Dependencies | ||||||
|  | ------------ | ||||||
|  |  | ||||||
|  | None  | ||||||
|  |  | ||||||
|  | License | ||||||
|  | ------- | ||||||
|  |  | ||||||
|  | GPL-3.0 for endlessh-go and this role. | ||||||
|  |  | ||||||
|  | Author Information | ||||||
|  | ------------------ | ||||||
|  |  | ||||||
|  | [endlessh-go by Shizunge](https://github.com/shizunge/endlessh-go) | ||||||
|  |  | ||||||
|  | This role was written by [Squip](https://github.com/squ1p) | ||||||
							
								
								
									
										9
									
								
								defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								defaults/main.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | --- | ||||||
|  | fwd_ports: | ||||||
|  |       prom: | ||||||
|  |         zone: home | ||||||
|  |         port: 2112/tcp | ||||||
|  |       ssh: | ||||||
|  |         zone: public | ||||||
|  |         port: 22/tcp | ||||||
|  |  | ||||||
							
								
								
									
										
											BIN
										
									
								
								files/endlesshgo-amd64.deb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								files/endlesshgo-amd64.deb
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										50
									
								
								tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | |||||||
|  | --- | ||||||
|  | - name: Copying .deb to remote | ||||||
|  |   when: ansible_os_family == "Debian" | ||||||
|  |   copy: | ||||||
|  |     src: files/endlesshgo-amd64.deb | ||||||
|  |     dest: /root/endlesshgo-amd64.deb | ||||||
|  |     mode: '0744' | ||||||
|  |   tags: | ||||||
|  |     - endlessh | ||||||
|  |  | ||||||
|  | - name: Install endlessh-go to remote | ||||||
|  |   when: ansible_os_family == "Debian" | ||||||
|  |   apt: | ||||||
|  |     deb: /root/endlesshgo-amd64.deb | ||||||
|  |   tags: | ||||||
|  |     - endlessh | ||||||
|  |  | ||||||
|  | - name: Enable and start the endlessh-go service | ||||||
|  |   block: | ||||||
|  |     - systemd: | ||||||
|  |         name: endlessh-go | ||||||
|  |         state: enabled | ||||||
|  |     - systemd: | ||||||
|  |         name: endlessh-go | ||||||
|  |         state: restarted | ||||||
|  |   tags: | ||||||
|  |     - endlessh | ||||||
|  |  | ||||||
|  | - name: Populate service_facts | ||||||
|  |   service_facts: | ||||||
|  |   tags: | ||||||
|  |     - endlessh | ||||||
|  |  | ||||||
|  | - name: Open Firewalld ports | ||||||
|  |   block: | ||||||
|  |     - firewalld: | ||||||
|  |         port: "{{ item.value.port }}" | ||||||
|  |         zone: "{{ item.value.zone }}" | ||||||
|  |         permanent: yes | ||||||
|  |         state: enabled | ||||||
|  |       loop: "{{ lookup('dict', fwd_ports) }}" | ||||||
|  |     - systemd: | ||||||
|  |         name: firewalld | ||||||
|  |         state: reloaded | ||||||
|  |   when: "'firewalld.service' in ansible_facts.services"  | ||||||
|  |   tags: | ||||||
|  |     - endlessh | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user