--- - name: Update and upgrade apt packages apt: upgrade: yes update_cache: yes cache_valid_time: 3600 - name: Install base packages apt: name: "{{ base_packages }}" state: present update_cache: yes - name: Configure timezone timezone: name: "{{ timezone }}" - name: Configure locale locale_gen: name: "{{ system_locale }}" state: present - name: Set default locale lineinfile: path: /etc/default/locale line: "LANG={{ system_locale }}" state: present create: yes - name: Ensure required directories exist file: path: "{{ item }}" state: directory mode: 0755 loop: - /opt/scripts - /etc/apt/keyrings - name: Install Python requests library apt: name: python3-requests state: present when: ansible_connection != "local"