Skip to content

Instantly share code, notes, and snippets.

@thapakazi
Last active April 11, 2023 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thapakazi/1618dd7bd81c6c3a3b16ceaeac9d0f93 to your computer and use it in GitHub Desktop.
Save thapakazi/1618dd7bd81c6c3a3b16ceaeac9d0f93 to your computer and use it in GitHub Desktop.
cat gpt generated yaml based on bash script ☺️
---
#
# Install ansible (like in ubuntu):
# sudo apt update
# sudo apt install software-properties-common
# sudo add-apt-repository --yes --update ppa:ansible/ansible
# sudo apt install -y ansible
# run with pull
# ansible-pull -U https://gist.github.com/thapakazi/1618dd7bd81c6c3a3b16ceaeac9d0f93 install-tiny-proxy.yaml -i "localhost," -c local
#
- name: Install and configure Tinyproxy
hosts: all
become: yes
tasks:
- name: Update apt cache and install Tinyproxy
ansible.builtin.apt:
name: tinyproxy
update_cache: yes
state: present
- name: Adjust Tinyproxy config - Bind to all interfaces
ansible.builtin.lineinfile:
path: /etc/tinyproxy/tinyproxy.conf
regexp: '^(Bind)(.*)'
line: 'Bind 0.0.0.0'
- name: Adjust Tinyproxy config - Allow access from specific IP range
ansible.builtin.lineinfile:
path: /etc/tinyproxy/tinyproxy.conf
regexp: '^(Allow)(.*)'
line: 'Allow 0.0.0.0/0'
insertafter: '^Allow'
- name: Adjust Tinyproxy config - Set MaxClients
ansible.builtin.lineinfile:
path: /etc/tinyproxy/tinyproxy.conf
regexp: '^(MaxClients)(.*)'
line: 'MaxClients 10000'
- name: Create systemd override directory for Tinyproxy
ansible.builtin.file:
path: /etc/systemd/system/tinyproxy.service.d
state: directory
mode: '0755'
- name: Adjust systemd file for Tinyproxy - Set LimitNOFILE
ansible.builtin.blockinfile:
path: /etc/systemd/system/tinyproxy.service.d/override.conf
block: |
[Service]
LimitNOFILE=65536
create: yes
- name: Reload and restart Tinyproxy
ansible.builtin.systemd:
name: tinyproxy
state: restarted
daemon_reload: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment