Skip to content
Snippets Groups Projects
main.yml 1.44 KiB
Newer Older
  • Learn to ignore specific revisions
  • Klaus Frank's avatar
    Klaus Frank committed
    - name: "Check local ansible version >= {{ minimal_ansible_version }}"
      delegate_to: localhost
      vars:
        ansible_connection: local
      run_once: true
      assert:
        msg: "Ansible must be {{ minimal_ansible_version }} or higher"
        that:
          - ansible_version.string is version(minimal_ansible_version, ">=")
    
    - name: PREREQUIREMENTS | Get os-release
      raw: cat /etc/os-release
      register: os_release
    
    Klaus Frank's avatar
    Klaus Frank committed
      changed_when: false
    
    Klaus Frank's avatar
    Klaus Frank committed
    
    
    Klaus Frank's avatar
    Klaus Frank committed
    - name: PREREQUIREMENTS | ArchLinux
      when: os_release.stdout.find("ID=arch") != -1
      block:
        - name: PREREQUIREMENTS | Update package index (pacman)
          raw: pacman -Sy
          changed_when: false
        - name: PREREQUIREMENTS | Install packages (pacman)
          raw: pacman --needed --noconfirm -S {{ archlinux_prerequirements_packages|join(" ") }}
          register: command_res
          changed_when: command_res.stdout.find('there is nothing to do') == -1
    
    - name: PREREQUIREMENTS | Ubuntu
      when: os_release.stdout.find("ID=ubuntu")
      block:
        - name: PREREQUIREMENTS | Update package index (apt)
          raw: apt update
          changed_when: false
        - name: PREREQUIREMENTS | Install packages (apt)
          raw: apt install -y {{ ubuntu_prerequirements_packages|join(" ") }}
          register: command_res
          changed_when: command_res.stdout.find('0 upgraded, 0 newly installed, 0 to remove and ') == -1
    
    Klaus Frank's avatar
    Klaus Frank committed
    
    - name: PREREQUIREMENTS | Gather facts
      setup: null
    
    - name: PEREQUIREMENTS | Update inventory
      set_fact:
        ansible_python_interpreter: python3