Allow to install murmur server #2
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					.venv
 | 
				
			||||||
 | 
					.vscode
 | 
				
			||||||
 | 
					.gitignore
 | 
				
			||||||
							
								
								
									
										53
									
								
								files/scripts/mice.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								files/scripts/mice.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import argparse
 | 
				
			||||||
 | 
					import logging
 | 
				
			||||||
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import Ice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import Murmur
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def init(host, port, timeout):
 | 
				
			||||||
 | 
					    logging.debug("Initializing ICE connection")
 | 
				
			||||||
 | 
					    proxy_str = f"Meta: tcp -h {host} -p {port} -t {timeout}"
 | 
				
			||||||
 | 
					    with Ice.initialize() as communicator:
 | 
				
			||||||
 | 
					        proxy = communicator.stringToProxy(proxy_str)
 | 
				
			||||||
 | 
					        mice = Murmur.MetaPrx.checkedCast(proxy)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if not mice:
 | 
				
			||||||
 | 
					            raise RuntimeError(f"Invalid Proxy: {proxy_str}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        servers = mice.getAllServers()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if len(servers) == 0:
 | 
				
			||||||
 | 
					            raise RuntimeError("No Mumble server found")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return servers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def main():
 | 
				
			||||||
 | 
					    parser = argparse.ArgumentParser(
 | 
				
			||||||
 | 
					        description="Manage Mumble server through ICE connection",
 | 
				
			||||||
 | 
					        formatter_class=argparse.ArgumentDefaultsHelpFormatter
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    parser.add_argument("--host", "-h", default="127.0.0.1",
 | 
				
			||||||
 | 
					                        help="ICE host or ip")
 | 
				
			||||||
 | 
					    parser.add_argument("--port", "-p", default=6502,
 | 
				
			||||||
 | 
					                        help="ICE port number")
 | 
				
			||||||
 | 
					    parser.add_argument("--timeout", "-t", default=1000,
 | 
				
			||||||
 | 
					                        help="Connection timeout in milliseconds")
 | 
				
			||||||
 | 
					    args = parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    try:
 | 
				
			||||||
 | 
					        servers = init(args.host, args.port, args.timeout)
 | 
				
			||||||
 | 
					    except RuntimeError as e:
 | 
				
			||||||
 | 
					        logging.error(e, exc_info=e)
 | 
				
			||||||
 | 
					        return 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    print(servers.getChannels())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 | 
					    sys.exit(main())
 | 
				
			||||||
@ -1,9 +1,16 @@
 | 
				
			|||||||
- name: Install mumble-server package
 | 
					- name: Install mumble-server package
 | 
				
			||||||
  apt:
 | 
					  apt:
 | 
				
			||||||
    name: mumble-server
 | 
					    pkg: mumble-server
 | 
				
			||||||
    state: present
 | 
					    state: present
 | 
				
			||||||
  register: murmur_installed
 | 
					  register: murmur_installed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Install ICE dependencies for Python
 | 
				
			||||||
 | 
					  apt:
 | 
				
			||||||
 | 
					    pkg:
 | 
				
			||||||
 | 
					    - python3-zeroc-ice
 | 
				
			||||||
 | 
					    - zeroc-ice-compilers
 | 
				
			||||||
 | 
					  state: present
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Append ssl-cert group to {{ murmur_owner }} user
 | 
					- name: Append ssl-cert group to {{ murmur_owner }} user
 | 
				
			||||||
  user:
 | 
					  user:
 | 
				
			||||||
    name: "{{ murmur_owner }}"
 | 
					    name: "{{ murmur_owner }}"
 | 
				
			||||||
@ -38,3 +45,31 @@
 | 
				
			|||||||
    mode: "600"
 | 
					    mode: "600"
 | 
				
			||||||
  when: murmur_superuser_password is defined
 | 
					  when: murmur_superuser_password is defined
 | 
				
			||||||
  notify: change murmur superuser password
 | 
					  notify: change murmur superuser password
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Create mumble-ice directory
 | 
				
			||||||
 | 
					  file:
 | 
				
			||||||
 | 
					    path: /opt/mice/
 | 
				
			||||||
 | 
					    state: directory
 | 
				
			||||||
 | 
					    owner: root
 | 
				
			||||||
 | 
					    group: root
 | 
				
			||||||
 | 
					    chmod: "755"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Copy mice Python script
 | 
				
			||||||
 | 
					  copy:
 | 
				
			||||||
 | 
					    src: scripts/mice.py
 | 
				
			||||||
 | 
					    dest: /opt/mice/mice.py
 | 
				
			||||||
 | 
					    owner: root
 | 
				
			||||||
 | 
					    group: root
 | 
				
			||||||
 | 
					    chmod: "755"
 | 
				
			||||||
 | 
					  register: _murmur_mice_copied
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Compile Murmur.ice slice file
 | 
				
			||||||
 | 
					  command: |-
 | 
				
			||||||
 | 
					    slice2py --checksum \
 | 
				
			||||||
 | 
					      -I/usr/local/share/Ice \
 | 
				
			||||||
 | 
					      -I/usr/share/Ice/slice \
 | 
				
			||||||
 | 
					      -I/usr/share/ice/slice \
 | 
				
			||||||
 | 
					      /usr/share/slice/Murmur.ice
 | 
				
			||||||
 | 
					  args:
 | 
				
			||||||
 | 
					    chdir: /opt/mice/
 | 
				
			||||||
 | 
					  when: _murmur_mice_copied
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user