--- # Setup Playbook for Debian Linux # This playbook installs essential dependencies including Python and creates swap - name: Setup Debian Linux hosts hosts: alpine become: yes gather_facts: no vars: swap_file_size_mb: 1024 swap_file_state: present swap_file_existing_size_mb: 0 roles: - role: geerlingguy.swap swap_file_size_mb: 1024 swap_file_state: present tasks: - name: Update apt package index apt: update_cache: yes cache_valid_time: 3600 - name: Install essential packages apt: name: - python3 - python3-pip - vim - curl - wget - htop - tree - git - openssh-client - sudo - util-linux state: present - name: Create sudoers entry for vagrant user lineinfile: path: /etc/sudoers.d/vagrant line: "vagrant ALL=(ALL) NOPASSWD:ALL" create: yes mode: '0440' - name: Install Python packages pip: name: - ansible state: present become_user: vagrant - name: Verify Python installation command: python3 --version register: python_version changed_when: false - name: Show Python version debug: msg: "{{ python_version.stdout }}" - name: Verify pip installation command: pip3 --version register: pip_version changed_when: false - name: Show pip version debug: msg: "{{ pip_version.stdout }}" - name: Create test directory file: path: /home/vagrant/test state: directory owner: vagrant group: vagrant mode: '0755' - name: Display system information command: uname -a register: system_info changed_when: false - name: Show system information debug: msg: "{{ system_info.stdout }}" - name: Check memory and swap usage command: free -m register: memory_info changed_when: false - name: Show memory and swap usage debug: msg: "{{ memory_info.stdout_lines }}"