--- ############################################################################## # debian / ubuntu - name: apt.conf proxy lineinfile: dest: /etc/apt/apt.conf regexp: '^Acquire::http::Proxy' line: 'Acquire::http::Proxy "{{ aptproxy }}";' create: yes when: - aptproxy is defined - name: remove nano tags: apt apt: name: nano state: absent purge: yes - name: remove ubuntu cloud init, etc. tags: apt apt: name: - cloud-init - cloud-guest-utils - cloud-initramfs-dyn-netconf - cloud-initramfs-copymods - netplan.io state: absent purge: yes when: - ansible_distribution == "Ubuntu" - name: disable systemd-networkd-wait-online.service on ubuntu service: name: systemd-networkd-wait-online.service enabled: false when: - ansible_distribution == "Ubuntu" - name: apt sources.list debian5 copy: src: sources.list.lenny dest: /etc/apt/sources.list when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "5" tags: apt - name: apt.conf allow-unauthenticated debian5 lineinfile: dest: /etc/apt/apt.conf line: 'APT::Get::AllowUnauthenticated "true";' create: yes when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "5" tags: apt - name: apt sources.list debian6 copy: src: sources.list.squeeze dest: /etc/apt/sources.list when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "6" tags: apt - name: apt.conf check-valid-until debian6 lineinfile: dest: /etc/apt/apt.conf line: 'Acquire::Check-Valid-Until "0";' create: yes when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "6" tags: apt - name: apt sources.list debian8 tags: apt copy: src: sources.list.jessie dest: /etc/apt/sources.list when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "8" - name: apt sources.list debian9 tags: apt copy: src: sources.list.stretch dest: /etc/apt/sources.list when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "9" - name: apt sources.list debian10 tags: apt copy: src: sources.list.buster dest: /etc/apt/sources.list when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "10" - name: apt sources.list debian11 tags: apt copy: src: sources.list.bullseye dest: /etc/apt/sources.list when: - (ansible_distribution == "Debian" and ansible_distribution_major_version == "11") - name: apt sources.list debian12 tags: apt copy: src: sources.list.bookworm dest: /etc/apt/sources.list when: - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() == 12) - name: apt.conf allow unauthenticated debian8 tags: apt lineinfile: dest: /etc/apt/apt.conf regexp: '^APT::Get::AllowUnauthenticated' line: 'APT::Get::AllowUnauthenticated "1";' create: yes when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "8" - name: apt.conf allow expired debian8 tags: apt lineinfile: dest: /etc/apt/apt.conf regexp: '^Acquire::Check-Valid-Until' line: 'Acquire::Check-Valid-Until "0";' create: yes when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "8" # ha veletlenul /dev/sdb lesz a bootdisk, elhasalna a grub-pc non-interacive # upgrade-je a kovetkezo lepesben - name: set debconf grub-pc/install_devices to /dev/sdb if needed tags: apt shell: 'mount | grep -q "/dev/sdb1 .* /boot" && (echo "set grub-pc/install_devices /dev/sdb" | debconf-communicate) || true' - name: apt update tags: apt apt: update_cache: yes - name: install packages tags: apt apt: name: aptitude state: present - name: apt full-upgrade tags: apt apt: upgrade: full - name: reset grub-pc/install_devices if changed 4 steps earlier tags: apt shell: 'mount | grep -q "/dev/sdb1 .* /boot" && (echo "set grub-pc/install_devices /dev/sda" | debconf-communicate) || true' - name: install common packages for all opsys versions tags: apt apt: name: - bind9-host - bzip2 - curl - file - git - bsd-mailx - iotop - libpam-systemd - locales - lsof - make - mc - mtr-tiny - ngrep - openssl - parted - patch - postfix - psmisc - pwgen - rename - rsync - screen - strace - subversion - sysstat - tcpdump - telnet - unzip - vim - w3m - xz-utils - zip - libfile-slurp-perl - libjson-perl - net-tools - man - ifupdown - mosh - python3-redis state: present - name: install packages for debian0-11 ubuntu20 tags: apt apt: name: - ntp - ntpdate - mlocate state: present when: - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() <= 11) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() == 20) - name: install packages for debian0-10 tags: apt apt: name: - dnsutils state: present when: - ansible_distribution == "Debian" - ansible_distribution_major_version|int() <= 10 - name: install packages for debian11-99 ubuntu20-99 tags: apt apt: name: - bind9-dnsutils - rsyslog - plocate state: present when: - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 11) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) - name: install packages for debian12-99 ubuntu22-99 tags: apt apt: name: - ntpsec - ntpsec-ntpdate state: present when: - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 12) or (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 22) - name: install packages for ubuntu22-99 tags: apt apt: name: - iputils-ping state: present when: - (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 22) - name: open-vm-tools apt: name: open-vm-tools state: present purge: yes tags: - vmware - apt - name: copy pf6 package tags: pf6 copy: src: pf6_1_all.deb dest: /tmp - name: install pf6 package tags: pf6 apt: deb: /tmp/pf6_1_all.deb - name: grub defaults, debian8 tags: grub patch: src: default_grub.patch.jessie dest: /etc/default/grub when: - ansible_distribution == "Debian" - ansible_distribution_major_version == "8" - name: grub defaults, debian9-11 tags: grub patch: src: default_grub.patch.stretch dest: /etc/default/grub when: - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 9 and ansible_distribution_major_version|int() < 12) - name: grub defaults, debian12-99 tags: grub patch: src: default_grub.patch.bookworm dest: /etc/default/grub when: - (ansible_distribution == "Debian" and ansible_distribution_major_version|int() >= 12) - name: grub defaults, ubuntu20-99 tags: grub lineinfile: path: /etc/default/grub regexp: "^GRUB_CMDLINE_LINUX=" line: 'GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"' when: - (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int() >= 20) - name: update-grub tags: grub command: update-grub - name: edit locale.gen tags: locales replace: dest: /etc/locale.gen regexp: '^#\s*(hu_HU|en_US)' replace: '\1' - name: run locale-gen tags: locales command: locale-gen # vim: set tabstop=2 shiftwidth=2 expandtab smarttab: