| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | ---
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  | ################################
 | 
					
						
							|  |  |  | # T-Pot - Bootstrapping Python #
 | 
					
						
							|  |  |  | ################################
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - name: T-Pot - Bootstrapping Python
 | 
					
						
							|  |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: false
 | 
					
						
							|  |  |  |   become: true
 | 
					
						
							|  |  |  |   become_method: sudo
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							|  |  |  |     - name: Get distribution name (All)
 | 
					
						
							|  |  |  |       raw: awk -F= '/^NAME/{print $2}' /etc/os-release | tr -d '"' | cut -d " " -f1
 | 
					
						
							|  |  |  |       register: my_distribution
 | 
					
						
							|  |  |  |       tags:
 | 
					
						
							|  |  |  |         - "AlmaLinux"
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     - name: Check if python3 is installed (All)
 | 
					
						
							|  |  |  |       raw: echo $(command -v python3)
 | 
					
						
							|  |  |  |       register: my_python3
 | 
					
						
							|  |  |  |       tags:
 | 
					
						
							|  |  |  |         - "AlmaLinux"
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - name: Add python package (Debian, Raspbian, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  |       raw: |
 | 
					
						
							|  |  |  |         apt update
 | 
					
						
							|  |  |  |         apt -y install python3
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: my_distribution.stdout | trim in ["Debian", "Raspbian", "Ubuntu"] and my_python3.stdout | trim == ""
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     - name: Add python package (Alma, Fedora, Rocky)
 | 
					
						
							|  |  |  |       raw: |
 | 
					
						
							|  |  |  |         dnf -y --refresh install python3
 | 
					
						
							|  |  |  |       when: my_distribution.stdout | trim in ["AlmaLinux", "Fedora", "Rocky"] and my_python3.stdout | trim == ""
 | 
					
						
							|  |  |  |       tags:
 | 
					
						
							|  |  |  |         - "AlmaLinux"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "Rocky"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     - name: Add python package (openSUSE Tumbleweed)
 | 
					
						
							|  |  |  |       raw: |
 | 
					
						
							|  |  |  |         zypper refresh
 | 
					
						
							|  |  |  |         zypper -y install python3
 | 
					
						
							|  |  |  |       when: my_distribution.stdout | trim in ["AlmaLinux", "Fedora", "Rocky"] and my_python3.stdout | trim == ""
 | 
					
						
							|  |  |  |       tags:
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  | #####################################################################
 | 
					
						
							|  |  |  | # T-Pot - Abort if run as tpot, root or on unsupported distribution #
 | 
					
						
							|  |  |  | #####################################################################
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  | - name: T-Pot - Abort if run as tpot, root or on unsupported distribution
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							| 
									
										
										
										
											2023-06-30 11:15:30 +00:00
										 |  |  |   become: false
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |   tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - "Debian"
 | 
					
						
							|  |  |  |     - "Fedora"
 | 
					
						
							|  |  |  |     - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |     - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-30 11:15:30 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  |   tasks:
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - name: Check if running as root (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |       assert:
 | 
					
						
							|  |  |  |         that: ansible_user_id != 'root'
 | 
					
						
							|  |  |  |         fail_msg: "T-Pot playbook should not be run as root."
 | 
					
						
							|  |  |  |         success_msg: "Running as user: {{ ansible_user_id }}."
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     - name: Check if running as tpot (All)
 | 
					
						
							|  |  |  |       assert:
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:16:15 +00:00
										 |  |  |         that: ansible_user_id != 'tpot'
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:55:59 +00:00
										 |  |  |         fail_msg: "Reserved username `tpot` detected."
 | 
					
						
							|  |  |  |         success_msg: "Running as user: {{ ansible_user_id }}."
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - name: Check if supported distribution (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |       assert:
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         that: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |         fail_msg: "T-Pot is not supported on this plattform: {{ ansible_distribution }}."
 | 
					
						
							|  |  |  |         success_msg: "T-Pot will now install on {{ ansible_distribution }}."
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  | ############################################################
 | 
					
						
							|  |  |  | # T-Pot - Install recommended, remove conflicting packages #
 | 
					
						
							|  |  |  | ############################################################
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  | - name: T-Pot - Install recommended, remove conflicting packages 
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							|  |  |  |   become: true
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |     - name: Syncing clocks (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       shell: "hwclock --hctosys"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-06 15:44:57 +00:00
										 |  |  |       ignore_errors: true
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - name: Install recommended packages (Debian, Raspbian, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       package:
 | 
					
						
							|  |  |  |         name:
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - apache2-utils
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |           - bash-completion
 | 
					
						
							|  |  |  |           - ca-certificates
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - cracklib-runtime
 | 
					
						
							| 
									
										
										
										
											2024-03-23 20:23:28 +00:00
										 |  |  |           - cron
 | 
					
						
							| 
									
										
										
										
											2023-11-01 13:13:16 +00:00
										 |  |  |           - curl
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |           - git
 | 
					
						
							|  |  |  |           - gnupg
 | 
					
						
							|  |  |  |           - grc
 | 
					
						
							| 
									
										
										
										
											2024-03-22 17:09:18 +00:00
										 |  |  |           - htop
 | 
					
						
							| 
									
										
										
										
											2023-11-01 13:13:16 +00:00
										 |  |  |           - micro
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |           - net-tools
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - vim
 | 
					
						
							|  |  |  |           - wget
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |         state: latest
 | 
					
						
							|  |  |  |         update_cache: yes
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["Debian", "Raspbian", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Install grc from remote repo (AlmaLinux, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |       ansible.builtin.dnf:
 | 
					
						
							|  |  |  |         name: 'https://github.com/kriipke/grc/releases/download/1.13.8/grc-1.13.8-1.el7.noarch.rpm'
 | 
					
						
							|  |  |  |         disable_gpg_check: true
 | 
					
						
							|  |  |  |         state: present
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-23 18:16:50 +00:00
										 |  |  |     - name: Install recommended packages (AlmaLinux, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |       package:
 | 
					
						
							|  |  |  |         name:
 | 
					
						
							|  |  |  |           - bash-completion
 | 
					
						
							|  |  |  |           - ca-certificates
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - cracklib
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |           - curl
 | 
					
						
							|  |  |  |           - dnf-plugins-core
 | 
					
						
							|  |  |  |           - git
 | 
					
						
							|  |  |  |           - grc
 | 
					
						
							| 
									
										
										
										
											2024-03-22 17:09:18 +00:00
										 |  |  |           - htop
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - httpd-tools
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |           - net-tools
 | 
					
						
							| 
									
										
										
										
											2024-03-23 18:21:32 +00:00
										 |  |  |           - tar
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - vim
 | 
					
						
							|  |  |  |           - wget
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         state: latest
 | 
					
						
							|  |  |  |         update_cache: yes
 | 
					
						
							| 
									
										
										
										
											2024-03-23 18:16:50 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-23 20:41:17 +00:00
										 |  |  |     - name: Download and install micro editor (AlmaLinux, openSUSE Tumbleweed, Rocky)
 | 
					
						
							| 
									
										
										
										
											2024-03-23 18:21:32 +00:00
										 |  |  |       shell: "curl https://getmic.ro | bash && mv micro /usr/bin"
 | 
					
						
							|  |  |  |       args:
 | 
					
						
							|  |  |  |         executable: /bin/bash
 | 
					
						
							| 
									
										
										
										
											2024-03-23 20:41:17 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "openSUSE Tumbleweed", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2024-03-23 18:21:32 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2024-03-23 20:41:17 +00:00
										 |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2024-03-23 18:21:32 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-23 18:16:50 +00:00
										 |  |  |     - name: Install recommended packages (Fedora)
 | 
					
						
							|  |  |  |       package:
 | 
					
						
							|  |  |  |         name:
 | 
					
						
							|  |  |  |           - bash-completion
 | 
					
						
							|  |  |  |           - ca-certificates
 | 
					
						
							|  |  |  |           - cracklib
 | 
					
						
							| 
									
										
										
										
											2024-03-23 19:08:27 +00:00
										 |  |  |           - cronie
 | 
					
						
							| 
									
										
										
										
											2024-03-23 18:16:50 +00:00
										 |  |  |           - curl
 | 
					
						
							|  |  |  |           - dnf-plugins-core
 | 
					
						
							|  |  |  |           - git
 | 
					
						
							|  |  |  |           - grc
 | 
					
						
							|  |  |  |           - htop
 | 
					
						
							|  |  |  |           - httpd-tools
 | 
					
						
							|  |  |  |           - micro
 | 
					
						
							|  |  |  |           - net-tools
 | 
					
						
							|  |  |  |           - vim
 | 
					
						
							|  |  |  |           - wget
 | 
					
						
							|  |  |  |         state: latest
 | 
					
						
							|  |  |  |         update_cache: yes
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["Fedora"]
 | 
					
						
							|  |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 14:56:18 +00:00
										 |  |  |     - name: Remove conflicting packages (openSUSE Tumbleweed)
 | 
					
						
							|  |  |  |       package:
 | 
					
						
							|  |  |  |         name:
 | 
					
						
							|  |  |  |           - cups
 | 
					
						
							|  |  |  |           - net-tools
 | 
					
						
							|  |  |  |           - postfix
 | 
					
						
							|  |  |  |           - yast2-auth-client
 | 
					
						
							|  |  |  |           - yast2-auth-user
 | 
					
						
							| 
									
										
										
										
											2024-05-11 08:12:47 +00:00
										 |  |  |         state: absent
 | 
					
						
							| 
									
										
										
										
											2023-06-25 14:56:18 +00:00
										 |  |  |         update_cache: yes
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["openSUSE Tumbleweed"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-06-25 14:56:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |     - name: Install recommended packages (openSUSE Tumbleweed)
 | 
					
						
							|  |  |  |       package:
 | 
					
						
							|  |  |  |         name:
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - apache2-utils
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |           - bash-completion
 | 
					
						
							|  |  |  |           - busybox-net-tools
 | 
					
						
							|  |  |  |           - ca-certificates
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - cracklib
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |           - curl
 | 
					
						
							|  |  |  |           - git
 | 
					
						
							|  |  |  |           - grc
 | 
					
						
							| 
									
										
										
										
											2024-03-22 17:09:18 +00:00
										 |  |  |           - htop
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |           - vim
 | 
					
						
							| 
									
										
										
										
											2023-07-05 21:03:41 +00:00
										 |  |  |           - wget
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |         state: latest
 | 
					
						
							|  |  |  |         update_cache: yes
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["openSUSE Tumbleweed"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  | #####################################
 | 
					
						
							|  |  |  | # T-Pot - Prepare for Docker Engine #
 | 
					
						
							|  |  |  | #####################################
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | - name: T-Pot - Prepare for and install Docker Engine
 | 
					
						
							|  |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							|  |  |  |   become: true
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							| 
									
										
										
										
											2024-06-28 10:02:12 +00:00
										 |  |  |     - name: Remove distribution based Docker packages and podman-docker (AlmaLinux, Debian, Fedora, Raspbian, Rocky, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       package:
 | 
					
						
							|  |  |  |         name:
 | 
					
						
							|  |  |  |           - docker
 | 
					
						
							|  |  |  |           - docker-engine
 | 
					
						
							|  |  |  |           - docker.io
 | 
					
						
							| 
									
										
										
										
											2024-06-28 10:02:12 +00:00
										 |  |  |           - containerd
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |           - runc
 | 
					
						
							| 
									
										
										
										
											2024-06-28 10:02:12 +00:00
										 |  |  |           - podman-docker
 | 
					
						
							| 
									
										
										
										
											2024-07-02 23:03:30 +00:00
										 |  |  |           - podman
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |         state: absent
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |         update_cache: yes
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - name: Add folder for Docker Engine GPG key (Debian, Raspbian, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       file:
 | 
					
						
							|  |  |  |         path: /etc/apt/keyrings
 | 
					
						
							|  |  |  |         state: directory
 | 
					
						
							|  |  |  |         mode: 0755
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["Debian", "Raspbian", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - name: Download Docker Engine GPG key (Debian, Raspbian, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       get_url:
 | 
					
						
							|  |  |  |         url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
 | 
					
						
							|  |  |  |         dest: /etc/apt/keyrings/docker
 | 
					
						
							|  |  |  |         mode: 0755
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["Debian", "Raspbian", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - name: Decrypt Docker Engine GPG key (Debian, Raspbian, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       shell: gpg --dearmor /etc/apt/keyrings/docker
 | 
					
						
							|  |  |  |       args:
 | 
					
						
							|  |  |  |         creates: /etc/apt/keyrings/docker.gpg
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["Debian", "Raspbian", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - name: Add Docker Engine repository (Debian, Raspbian, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       apt_repository:
 | 
					
						
							|  |  |  |         filename: docker
 | 
					
						
							| 
									
										
										
										
											2024-02-06 12:45:12 +00:00
										 |  |  |         repo: "deb [arch={{ ansible_architecture | replace('aarch64', 'arm64') | replace('x86_64', 'amd64') }} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |         state: present
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |         update_cache: yes
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["Debian", "Raspbian", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |     - name: Add Docker repository (Fedora)
 | 
					
						
							|  |  |  |       shell: |
 | 
					
						
							|  |  |  |         if [ "$(dnf repolist docker-ce-stable)" == "" ];
 | 
					
						
							|  |  |  |           then
 | 
					
						
							| 
									
										
										
										
											2025-01-08 22:27:02 +00:00
										 |  |  |             dnf -y config-manager addrepo --from-repofile=https://download.docker.com/linux/fedora/docker-ce.repo
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |         fi
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |       when: ansible_distribution in ["Fedora"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Add Docker repository (AlmaLinux, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |       shell: |
 | 
					
						
							|  |  |  |         if [ "$(dnf repolist docker-ce-stable)" == "" ];
 | 
					
						
							|  |  |  |           then
 | 
					
						
							|  |  |  |             dnf -y config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
 | 
					
						
							|  |  |  |         fi
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  | #################################
 | 
					
						
							|  |  |  | # T-Pot - Install Docker Engine #
 | 
					
						
							|  |  |  | #################################
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - name: T-Pot - Install Docker Engine
 | 
					
						
							|  |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							|  |  |  |   become: true
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |     - name: Install Docker Engine packages (openSUSE Tumbleweed)
 | 
					
						
							|  |  |  |       package:
 | 
					
						
							|  |  |  |         name:
 | 
					
						
							|  |  |  |           - docker
 | 
					
						
							| 
									
										
										
										
											2023-07-01 01:26:26 +00:00
										 |  |  |           - docker-bash-completion
 | 
					
						
							|  |  |  |           - docker-buildx
 | 
					
						
							|  |  |  |           - docker-compose
 | 
					
						
							|  |  |  |           - docker-compose-switch
 | 
					
						
							|  |  |  |           - liblvm2cmd2_03
 | 
					
						
							|  |  |  |           - lvm2
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |         state: latest
 | 
					
						
							|  |  |  |         update_cache: yes
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["openSUSE Tumbleweed"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - name: Install Docker Engine packages (AlmaLinux, Debian, Fedora, Raspbian, Rocky, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       package:
 | 
					
						
							|  |  |  |         name:
 | 
					
						
							|  |  |  |           - docker-ce 
 | 
					
						
							|  |  |  |           - docker-ce-cli 
 | 
					
						
							|  |  |  |           - containerd.io
 | 
					
						
							|  |  |  |           - docker-buildx-plugin
 | 
					
						
							|  |  |  |           - docker-compose-plugin 
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |         state: latest
 | 
					
						
							|  |  |  |         update_cache: yes
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - name: Stop Docker (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |       service:
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |         name: docker
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         state: stopped
 | 
					
						
							|  |  |  |         enabled: false
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ######################################################
 | 
					
						
							|  |  |  | # T-Pot - Adjust configs, add users and groups, etc. #
 | 
					
						
							|  |  |  | ######################################################
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - name: T-Pot - Adjust configs, add users and groups, etc.
 | 
					
						
							|  |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							|  |  |  |   become: true
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |     - name: Create T-Pot group (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       group:
 | 
					
						
							|  |  |  |         name: tpot
 | 
					
						
							|  |  |  |         gid: 2000
 | 
					
						
							|  |  |  |         state: present
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |     - name: Create T-Pot user (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       user:
 | 
					
						
							|  |  |  |         name: tpot
 | 
					
						
							|  |  |  |         uid: 2000
 | 
					
						
							|  |  |  |         system: yes
 | 
					
						
							|  |  |  |         shell: /bin/false
 | 
					
						
							|  |  |  |         home: /nonexistent
 | 
					
						
							|  |  |  |         group: tpot
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-10 14:48:17 +00:00
										 |  |  |     - name: Ensure vm.max_map_count is set (All)
 | 
					
						
							|  |  |  |       lineinfile:
 | 
					
						
							|  |  |  |         path: /etc/sysctl.conf
 | 
					
						
							|  |  |  |         line: "vm.max_map_count=262144"
 | 
					
						
							|  |  |  |         state: present
 | 
					
						
							|  |  |  |         create: yes
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							|  |  |  |       tags:
 | 
					
						
							|  |  |  |         - "AlmaLinux"
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							|  |  |  |         - "Raspbian"
 | 
					
						
							|  |  |  |         - "Rocky"
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |     - name: Disable ssh.socket unit (Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       systemd:
 | 
					
						
							|  |  |  |         name: ssh.socket
 | 
					
						
							|  |  |  |         state: stopped
 | 
					
						
							|  |  |  |         enabled: false
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |     - name: Remove ssh.socket.conf file (Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       file:
 | 
					
						
							|  |  |  |         path: /etc/systemd/system/ssh.service.d/00-socket.conf
 | 
					
						
							|  |  |  |         state: absent
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - name: Change SSH Port to 64295 (AlmaLinux, Debian, Fedora, Raspbian, Rocky, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       lineinfile:
 | 
					
						
							|  |  |  |         path: /etc/ssh/sshd_config
 | 
					
						
							|  |  |  |         line: "Port 64295"
 | 
					
						
							|  |  |  |         insertafter: EOF
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  |     - name: Change SSH Port to 64295 (openSUSE Tumbleweed)
 | 
					
						
							|  |  |  |       lineinfile:
 | 
					
						
							|  |  |  |         path: /etc/ssh/sshd_config.d/port.conf
 | 
					
						
							|  |  |  |         line: "Port 64295"
 | 
					
						
							|  |  |  |         create: yes
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["openSUSE Tumbleweed"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-06-25 11:17:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Add T-Pot SSH port to Firewall (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       firewalld:
 | 
					
						
							|  |  |  |         port: 64295/tcp
 | 
					
						
							|  |  |  |         permanent: yes
 | 
					
						
							|  |  |  |         state: enabled
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Set T-Pot default target to ACCEPT (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       firewalld:
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |         zone: public
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |         target: ACCEPT
 | 
					
						
							|  |  |  |         permanent: yes
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |         state: enabled
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Load kernel modules (AlmaLinux, Fedora, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       command: modprobe -v iptable_filter
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Update iptables.conf (AlmaLinux, Fedora, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       lineinfile:
 | 
					
						
							|  |  |  |         path: /etc/modules-load.d/iptables.conf
 | 
					
						
							|  |  |  |         line: iptable_filter
 | 
					
						
							|  |  |  |         create: yes
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Set SELinux config to permissive (AlmaLinux, Fedora, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       lineinfile:
 | 
					
						
							|  |  |  |         path: /etc/selinux/config
 | 
					
						
							|  |  |  |         regexp: '^SELINUX='
 | 
					
						
							|  |  |  |         line: 'SELINUX=permissive'
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Set SELinux to permissive (AlmaLinux, Fedora, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-07-03 14:45:40 +00:00
										 |  |  |       command: "setenforce Permissive"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-03 14:45:40 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 14:45:40 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 14:45:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - name: Stop Resolved (Fedora, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-30 23:23:57 +00:00
										 |  |  |       service:
 | 
					
						
							|  |  |  |         name: systemd-resolved
 | 
					
						
							|  |  |  |         state: stopped
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["Fedora", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-30 23:23:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-18 15:57:41 +00:00
										 |  |  |     - name: Copy resolved.conf to /etc/systemd (Fedora)
 | 
					
						
							|  |  |  |       copy:
 | 
					
						
							|  |  |  |         src: /usr/lib/systemd/resolved.conf
 | 
					
						
							|  |  |  |         dest: /etc/systemd/resolved.conf
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["Fedora"]
 | 
					
						
							|  |  |  |       ignore_errors: true
 | 
					
						
							|  |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |     - name: Modify DNSStubListener in resolved.conf (Fedora, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       lineinfile:
 | 
					
						
							|  |  |  |         path: /etc/systemd/resolved.conf
 | 
					
						
							|  |  |  |         regexp: '^.*DNSStubListener=.*'
 | 
					
						
							|  |  |  |         line: 'DNSStubListener=no'
 | 
					
						
							|  |  |  |         state: present
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["Fedora", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ############################
 | 
					
						
							|  |  |  | # T-Pot - Restart services #
 | 
					
						
							|  |  |  | ############################
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  | - name: T-Pot - Restart services
 | 
					
						
							|  |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							|  |  |  |   become: true
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							|  |  |  |     - name: Start Resolved (Fedora, Ubuntu)
 | 
					
						
							| 
									
										
										
										
											2023-06-30 22:31:50 +00:00
										 |  |  |       service:
 | 
					
						
							| 
									
										
										
										
											2023-06-30 23:23:57 +00:00
										 |  |  |         name: systemd-resolved
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         state: restarted
 | 
					
						
							| 
									
										
										
										
											2023-06-30 22:31:50 +00:00
										 |  |  |       when: ansible_distribution in ["Fedora", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Restart Firewalld (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       service:
 | 
					
						
							|  |  |  |         name: firewalld
 | 
					
						
							|  |  |  |         state: restarted
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-06-30 22:31:50 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Get Firewall rules (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-07-02 13:05:55 +00:00
										 |  |  |       command: "firewall-cmd --list-all"
 | 
					
						
							|  |  |  |       register: firewall_output
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 13:05:55 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 13:05:55 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 13:05:55 +00:00
										 |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - name: Print Firewall rules (AlmaLinux, Fedora, openSUSE Tumbleweed, Rocky)
 | 
					
						
							| 
									
										
										
										
											2023-07-02 13:05:55 +00:00
										 |  |  |       debug:
 | 
					
						
							|  |  |  |         var: firewall_output.stdout_lines
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Fedora", "openSUSE Tumbleweed", "Rocky"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 13:05:55 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 13:05:55 +00:00
										 |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 13:05:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - name: Enable Docker Engine upon boot (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |       service:
 | 
					
						
							| 
									
										
										
										
											2023-06-30 23:23:57 +00:00
										 |  |  |         name: docker
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         state: restarted
 | 
					
						
							|  |  |  |         enabled: true
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - name: Restart SSH (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |       service:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         name: "{{ 'ssh' if ansible_distribution in ['Ubuntu'] else 'sshd' }}"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |         state: restarted
 | 
					
						
							|  |  |  |         enabled: true
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |       tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |         - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |         - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |         - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |         - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #######################################################################
 | 
					
						
							|  |  |  | # T-Pot - Adjust group users, bashrc, clone / update T-Pot repository #
 | 
					
						
							|  |  |  | #######################################################################
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - name: T-Pot - Adjust group users, bashrc, clone / update T-Pot repository
 | 
					
						
							|  |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							| 
									
										
										
										
											2023-06-30 11:15:30 +00:00
										 |  |  |   become: false
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |   tags:
 | 
					
						
							| 
									
										
										
										
											2023-07-03 21:43:31 +00:00
										 |  |  |     - "AlmaLinux"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - "Debian"
 | 
					
						
							|  |  |  |     - "Fedora"
 | 
					
						
							|  |  |  |     - "openSUSE Tumbleweed"
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |     - "Raspbian"
 | 
					
						
							| 
									
										
										
										
											2023-07-03 20:47:13 +00:00
										 |  |  |     - "Rocky"
 | 
					
						
							| 
									
										
										
										
											2023-07-02 12:52:06 +00:00
										 |  |  |     - "Ubuntu"
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							| 
									
										
										
										
											2024-03-24 15:21:51 +00:00
										 |  |  |     - name: Check for non-root user id (All)
 | 
					
						
							|  |  |  |       debug:
 | 
					
						
							|  |  |  |         msg: "Detected user: '{{ ansible_user_id }}'"
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							|  |  |  |       failed_when: ansible_user_id == "root"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-03 10:54:03 +00:00
										 |  |  |     - name: Add aliases (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       blockinfile:
 | 
					
						
							|  |  |  |         path: ~/.bashrc
 | 
					
						
							|  |  |  |         block: |
 | 
					
						
							| 
									
										
										
										
											2023-11-01 15:19:24 +00:00
										 |  |  |           alias dps='grc --colour=on docker ps -f status=running -f status=exited --format "table {{'{{'}}.Names{{'}}'}}\\t{{'{{'}}.Status{{'}}'}}\\t{{'{{'}}.Ports{{'}}'}}" | sort'
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |           alias dpsw='watch -c bash -ic dps'
 | 
					
						
							| 
									
										
										
										
											2023-11-01 13:13:16 +00:00
										 |  |  |           alias mi='micro'
 | 
					
						
							|  |  |  |           alias sudo='sudo '
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |         marker: "# {mark} ANSIBLE MANAGED BLOCK"
 | 
					
						
							|  |  |  |         insertafter: EOF
 | 
					
						
							|  |  |  |         state: present
 | 
					
						
							| 
									
										
										
										
											2025-02-03 10:54:03 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2024-05-07 09:26:22 +00:00
										 |  |  |       tags:
 | 
					
						
							|  |  |  |         - "AlmaLinux"
 | 
					
						
							|  |  |  |         - "Debian"
 | 
					
						
							|  |  |  |         - "Fedora"
 | 
					
						
							|  |  |  |         - "openSUSE Tumbleweed"
 | 
					
						
							|  |  |  |         - "Raspbian"
 | 
					
						
							|  |  |  |         - "Rocky"
 | 
					
						
							|  |  |  |         - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |     - name: Clone / Update T-Pot repository (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       git:
 | 
					
						
							|  |  |  |         repo: 'https://github.com/telekom-security/tpotce'
 | 
					
						
							|  |  |  |         dest: '/home/{{ ansible_user_id }}/tpotce/'
 | 
					
						
							| 
									
										
										
										
											2024-12-11 11:53:50 +00:00
										 |  |  |         version: master
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |         clone: yes
 | 
					
						
							|  |  |  |         update: no
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-24 12:05:13 +00:00
										 |  |  |     - name: Add current user to Docker, T-Pot group (All)
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  |       become: true
 | 
					
						
							|  |  |  |       user:
 | 
					
						
							|  |  |  |         name: "{{ ansible_user_id }}"
 | 
					
						
							|  |  |  |         groups: 
 | 
					
						
							|  |  |  |           - docker
 | 
					
						
							|  |  |  |           - tpot
 | 
					
						
							|  |  |  |         append: yes
 | 
					
						
							| 
									
										
										
										
											2023-11-01 14:51:56 +00:00
										 |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2023-06-22 18:30:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-22 17:09:18 +00:00
										 |  |  | ########################################
 | 
					
						
							|  |  |  | # T-Pot - Install service and cron job #
 | 
					
						
							|  |  |  | ########################################
 | 
					
						
							| 
									
										
										
										
											2024-03-19 12:56:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | - name: T-Pot - Install service
 | 
					
						
							|  |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							|  |  |  |   become: false
 | 
					
						
							|  |  |  |   tags:
 | 
					
						
							|  |  |  |     - "AlmaLinux"
 | 
					
						
							|  |  |  |     - "Debian"
 | 
					
						
							|  |  |  |     - "Fedora"
 | 
					
						
							|  |  |  |     - "openSUSE Tumbleweed"
 | 
					
						
							|  |  |  |     - "Raspbian"
 | 
					
						
							|  |  |  |     - "Rocky"
 | 
					
						
							|  |  |  |     - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							|  |  |  |     - name: Install systemd service (All)
 | 
					
						
							|  |  |  |       become: true
 | 
					
						
							|  |  |  |       ansible.builtin.template:
 | 
					
						
							|  |  |  |         src: '/home/{{ ansible_user_id }}/tpotce/installer/install/tpot.service'
 | 
					
						
							|  |  |  |         dest: '/etc/systemd/system/tpot.service'
 | 
					
						
							|  |  |  |         owner: root
 | 
					
						
							|  |  |  |         group: root
 | 
					
						
							|  |  |  |         mode: '0755'
 | 
					
						
							|  |  |  |       notify: Reload systemd and enable service
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   handlers:
 | 
					
						
							|  |  |  |     - name: Reload systemd and enable service
 | 
					
						
							|  |  |  |       become: true
 | 
					
						
							|  |  |  |       ansible.builtin.systemd:
 | 
					
						
							|  |  |  |         name: tpot.service
 | 
					
						
							|  |  |  |         daemon_reload: yes
 | 
					
						
							|  |  |  |         state: stopped
 | 
					
						
							|  |  |  |         enabled: yes
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 | 
					
						
							| 
									
										
										
										
											2024-03-22 17:09:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | - name: T-Pot - Setup a randomized daily reboot
 | 
					
						
							|  |  |  |   hosts: all
 | 
					
						
							|  |  |  |   gather_facts: true
 | 
					
						
							|  |  |  |   become: yes
 | 
					
						
							|  |  |  |   tags:
 | 
					
						
							|  |  |  |     - "AlmaLinux"
 | 
					
						
							|  |  |  |     - "Debian"
 | 
					
						
							|  |  |  |     - "Fedora"
 | 
					
						
							|  |  |  |     - "openSUSE Tumbleweed"
 | 
					
						
							|  |  |  |     - "Raspbian"
 | 
					
						
							|  |  |  |     - "Rocky"
 | 
					
						
							|  |  |  |     - "Ubuntu"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   vars:
 | 
					
						
							|  |  |  |     random_minute: "{{ range(0, 60) | random }}"
 | 
					
						
							|  |  |  |     random_hour: "{{ range(0, 5) | random }}" # We want the reboot randomly happen at night
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   tasks:
 | 
					
						
							|  |  |  |     - name: Setup a randomized daily reboot (All)
 | 
					
						
							|  |  |  |       cron:
 | 
					
						
							|  |  |  |         name: "T-Pot Daily Reboot"
 | 
					
						
							|  |  |  |         user: root
 | 
					
						
							|  |  |  |         minute: "{{ random_minute }}"
 | 
					
						
							|  |  |  |         hour: "{{ random_hour }}"
 | 
					
						
							|  |  |  |         job: "bash -c 'systemctl stop tpot.service && docker container prune -f; docker image prune -f; docker volume prune -f; /usr/sbin/shutdown -r +1 \"T-Pot Daily Reboot\"'"
 | 
					
						
							|  |  |  |         state: present
 | 
					
						
							|  |  |  |       when: ansible_distribution in ["AlmaLinux", "Debian", "Fedora", "openSUSE Tumbleweed", "Raspbian", "Rocky", "Ubuntu"]
 |