Created
July 5, 2026 14:46
-
-
Save AbstractUmbra/a134bbfbbb20af47beebc7df1b9e01fb to your computer and use it in GitHub Desktop.
fun playbook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - name: Playbook for creating several repos and initial host setup | |
| hosts: localhost | |
| vars: | |
| ansible_python_interpreter: /usr/local/bin/python3.14 | |
| connection: local | |
| become: true | |
| vars_prompt: | |
| - name: kubernetes_version | |
| prompt: What Kubernetes version do you want to install? | |
| private: false | |
| default: "1.36" | |
| - name: node_version | |
| prompt: What node version do you want to install? | |
| private: false | |
| default: "24.x" | |
| tasks: | |
| - name: Set arch | |
| ansible.builtin.set_fact: | |
| arch: "{{ 'amd64' if ansible_facts['architecture'] == 'x86_64' else 'arm64' }}" | |
| - name: Setup docker repo | |
| ansible.builtin.deb822_repository: | |
| name: docker | |
| types: ["deb"] | |
| uris: https://download.docker.com/linux/{{ ansible_facts['distribution'] | lower }} | |
| suites: "{{ ansible_facts['distribution_release'] | lower }}" | |
| components: | |
| - stable | |
| architectures: | |
| - "{{ arch }}" | |
| signed_by: "https://download.docker.com/linux/ubuntu/gpg" | |
| install_python_debian: true | |
| - name: Setup kubernetes repo | |
| ansible.builtin.deb822_repository: | |
| name: kubernetes | |
| types: ["deb"] | |
| uris: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/deb" | |
| suites: "/" | |
| signed_by: "https://pkgs.k8s.io/core:/stable:/v{{ kubernetes_version }}/deb/Release.key" | |
| install_python_debian: true | |
| - name: Setup tailscale repo | |
| ansible.builtin.deb822_repository: | |
| name: tailscale | |
| types: ["deb"] | |
| uris: "https://pkgs.tailscale.com/stable/{{ ansible_facts['distribution'] | lower }}" | |
| suites: "{{ ansible_facts['distribution_release'] | lower }}" | |
| components: | |
| - main | |
| signed_by: "https://pkgs.tailscale.com/stable/{{ ansible_facts['distribution'] | lower }}/{{ ansible_facts['distribution_release'] | lower }}.noarmor.gpg" | |
| install_python_debian: true | |
| - name: Setup Node repo | |
| block: | |
| - name: Setup node repo | |
| ansible.builtin.deb822_repository: | |
| name: node | |
| types: ["deb"] | |
| uris: https://deb.nodesource.com/node_{{ node_version }} | |
| suites: ["nodistro"] | |
| components: | |
| - main | |
| architectures: | |
| - "{{ arch }}" | |
| signed_by: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | |
| install_python_debian: true | |
| - name: Create default nsolid apt repo preferences | |
| ansible.builtin.copy: | |
| dest: /etc/apt/preferences.d/nsolid | |
| content: | | |
| Package: nsolid | |
| Pin: origin deb.nodesource.com | |
| Pin-Priority: 600 | |
| mode: "0644" | |
| - name: Create default nodejs apt repo preferences | |
| ansible.builtin.copy: | |
| dest: /etc/apt/preferences.d/nsolid | |
| content: | | |
| Package: nodejs | |
| Pin: origin deb.nodesource.com | |
| Pin-Priority: 600 | |
| mode: "0644" | |
| - name: Setup postgres repo | |
| ansible.builtin.deb822_repository: | |
| name: postgresql | |
| types: ["deb", "deb-src"] | |
| uris: https://apt.postgresql.org/pub/repos/apt | |
| suites: "{{ ansible_facts['distribution_release'] }}-pgdg" | |
| components: | |
| - main | |
| architectures: | |
| - "{{ arch }}" | |
| signed_by: https://www.postgresql.org/media/keys/ACCC4CF8.asc | |
| install_python_debian: true | |
| - name: Setup cloudflared repo | |
| ansible.builtin.deb822_repository: | |
| name: cloudflared | |
| types: ["deb"] | |
| uris: https://pkg.cloudflare.com/cloudflared | |
| suites: any | |
| components: | |
| - main | |
| signed_by: https://pkg.cloudflare.com/cloudflare-main.gpg | |
| install_python_debian: true | |
| - name: Setup task repo | |
| ansible.builtin.deb822_repository: | |
| name: task | |
| types: ["deb", "deb-src"] | |
| uris: "https://dl.cloudsmith.io/public/task/task/deb/{{ ansible_facts['distribution'] | lower }}" | |
| suites: "{{ ansible_facts['distribution_release'] }}" | |
| components: | |
| - main | |
| signed_by: https://dl.cloudsmith.io/public/task/task/gpg.046FD1186CA342F0.key | |
| install_python_debian: true | |
| - name: Setup 1p | |
| block: | |
| - name: Setup 1p repo | |
| ansible.builtin.deb822_repository: | |
| name: 1password | |
| types: ["deb"] | |
| uris: https://downloads.1password.com/linux/debian/{{ arch }} | |
| suites: "stable" | |
| components: | |
| - main | |
| signed_by: https://downloads.1password.com/linux/keys/1password.asc | |
| install_python_debian: true | |
| - name: Setup 1p debsig dir | |
| ansible.builtin.file: | |
| path: /etc/debsig/policies/AC2D62742012EA22 | |
| state: directory | |
| mode: '0644' | |
| - name: Setup 1p debsig | |
| ansible.builtin.get_url: | |
| url: https://downloads.1password.com/linux/debian/debsig/1password.pol | |
| dest: /etc/debsig/policies/AC2D62742012EA22/1password.pol | |
| mode: '0644' | |
| - name: Full apt update, upgrade, clean and remove | |
| ansible.builtin.apt: | |
| autoclean: true | |
| autoremove: true | |
| clean: true | |
| install_recommends: true | |
| purge: true | |
| upgrade: full | |
| - name: Update apt cache, install basic deps | |
| ansible.builtin.apt: | |
| update_cache: true | |
| autoremove: true | |
| autoclean: true | |
| purge: true | |
| clean: true | |
| pkg: | |
| - ca-certificates | |
| - curl | |
| - apt-transport-https | |
| - gnupg | |
| - vim | |
| - ufw | |
| - fail2ban | |
| - docker-ce | |
| - docker-ce-cli | |
| - containerd.io | |
| - docker-buildx-plugin | |
| - docker-compose-plugin | |
| - tailscale | |
| - nodejs | |
| - jq | |
| - git | |
| - zsh | |
| - clang | |
| - g++ | |
| - build-essential | |
| - cloudflared | |
| - task | |
| - 1password-cli | |
| - name: Setup uv with pipx | |
| when: ansible_facts['distribution_major_version'] | int > 12 | |
| block: | |
| - name: Install pipx | |
| ansible.builtin.apt: | |
| pkg: | |
| - pipx | |
| - name: Install uv | |
| become: false | |
| register: uv_install_output | |
| changed_when: uv_install_output.rc != 0 | |
| ansible.builtin.command: | |
| cmd: pipx install uv | |
| - name: Setup pipx with uv | |
| when: ansible_facts['distribution_major_version'] | int <= 12 | |
| become: false | |
| block: | |
| - name: Download uv installer | |
| become: false | |
| ansible.builtin.get_url: | |
| url: https://astral.sh/uv/install.sh | |
| dest: /tmp/uv-install.sh | |
| mode: "0777" | |
| - name: Run uv installer | |
| become: false | |
| register: uv_output | |
| changed_when: uv_output.rc != 0 | |
| ansible.builtin.command: | |
| cmd: /tmp/uv-install.sh | |
| - name: Cleanup | |
| become: false | |
| ansible.builtin.file: | |
| path: /tmp/uv-install.sh | |
| state: absent | |
| - name: Install latest pipx | |
| become: false | |
| when: ansible_facts['distribution_major_version'] | int <= 12 | |
| register: pipx_output | |
| changed_when: pipx_output.rc != 0 | |
| ansible.builtin.command: | |
| cmd: uv tool install pipx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment