---
# tasks file for init
- name: main tasks
  include_tasks: '{{item}}.yml'
  with_items:
    - utility
    - sshd_config
- name: detect swap
  shell: '/sbin/swapon'
  register: swap_result
  changed_when: false
- name: add swap
  include_tasks: 'swapon.yml'
  when: 'ansible_memtotal_mb < 1024 and not swap_result.stdout'
- name: upgrade
  include_tasks: 'upgrade.yml'
  when: upgrade
- name: sshd_config again
  include_tasks: 'sshd_config.yml'
- name: hypervisor
  include_tasks: 'hypervisor.yml'
  when: ansible_virtualization_role == 'host'
- name: sysctl
  include_tasks: 'sysctl.yml'
- name: apt
  include_tasks: apt.yml
  when: ansible_os_family == 'Debian'
- name: yum
  include_tasks: yum.yml
  when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int == 7
- name: dnf
  include_tasks: dnf.yml
  when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int >= 8
- name: redhat configures
  include_tasks: redhat_configures.yml
  when: ansible_os_family == 'RedHat'
- name: pip
  include_tasks: pip.yml
- name: nvidia
  include_tasks: nvidia.yml
  when: nvidia_driver_version and ansible_os_family == 'Debian'
- name: docker
  include_tasks: docker.yml
  when: install_docker
- name: fish
  include_tasks: fish.yml
  when: customization and (ansible_os_family == 'Debian' or ansible_distribution == 'Fedora' or ansible_os_family == 'RedHat' and ansible_distribution_major_version|int == 8)
- name: customize
  include_tasks: '{{item}}.yml'
  with_items:
    - byobu
    - vim
    - git_config
  when: customization
