# ansible-playbook -i inventory.ini playbook.yml --key-file=keys/server -vv - name: Setup Left 4 Dead Server hosts: l4d2servers remote_user: root tasks: - name: Enable 32 bit architecture command: dpkg --add-architecture i386 - name: Update apt cache apt: update_cache: yes - name: Upgrade all packages apt: upgrade: dist - name: Install required packages apt: name: - wget - unzip - libarchive-tools - xvfb - curl state: present - name: Create keyrings directory file: path: /etc/apt/keyrings state: directory mode: '0755' - name: Download WineHQ repository key get_url: url: https://dl.winehq.org/wine-builds/winehq.key dest: /tmp/winehq.key - name: Convert WineHQ key to gpg format command: cmd: gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key /tmp/winehq.key creates: /etc/apt/keyrings/winehq-archive.key - name: Add WineHQ repository get_url: url: https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources dest: /etc/apt/sources.list.d/winehq-jammy.sources - name: Upgrade packages apt: upgrade: dist - name: Install WineHQ apt: name: - winehq-stable state: latest install_recommends: yes - name: Download NodeSource setup script get_url: url: https://deb.nodesource.com/setup_18.x dest: /tmp/nodesource_setup.sh - name: Run NodeSource setup script command: bash /tmp/nodesource_setup.sh - name: Install Node.js apt: name: nodejs state: present - name: Install PM2 npm: name: pm2 global: yes - name: Create steam user user: name: steam shell: /bin/bash state: present create_home: yes - name: Create /wine directory file: path: /wine state: directory owner: steam group: steam mode: '0755' - name: Create game environment copy: dest: /home/steam/.game.env owner: steam group: steam mode: '0644' content: | export DIR_WINE="/wine" export DIR_STEAMCMD="/wine/drive_c/SteamCMD" export DIR_SERVER="/wine/drive_c/l4d2server" export WINEPREFIX=$DIR_WINE - name: Add environment source to .bashrc lineinfile: path: /home/steam/.bashrc line: 'source $HOME/.game.env' owner: steam group: steam mode: '0644'