diff --git a/defaults/main.yml b/defaults/main.yml index 3e7fa3e..eaba2f6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,7 +11,7 @@ time: hwclock: UTC timezone: Europe/Paris -system_base_softwares: +system_base_softwares_arch: - 'zsh' - 'stow' - 'wol' @@ -42,5 +42,34 @@ system_base_softwares: - 'unrar' - 'git-lfs' +system_base_softwares_debian: + - 'zsh' + - 'stow' + - 'wakeonlan' + - 'nmap' + - 'dnsutils' + - 'rsync' + #- 'awesome-terminal-fonts' + - 'wget' + #- 'bat' + #- 'diff-so-fancy' + - 'git' + - 'htop' + - 'thefuck' + - 'tldr' + - 'ntfs-3g' + - 'python-lxml' + - 'tmux' + - 'vim' + - 'zsh-theme-powerlevel9k' + - 'python-pip' + - 'yarn' + - 'npm' + - 'nethogs' + - 'iftop' + - 'zip' + - 'unzip' + - 'unrar' + - 'git-lfs' -system_upgrade: false \ No newline at end of file +system_upgrade: false diff --git a/tasks/base_software.yml b/tasks/base_software.yml index 51fabf6..2864018 100644 --- a/tasks/base_software.yml +++ b/tasks/base_software.yml @@ -1,10 +1,12 @@ -- name: upgrade system +- name: upgrade arch-keyring pacman: state: latest # not required. choices: absent;latest;present. Desired state of the package. - name: archlinux-keyring # not required. Whether or not to upgrade whole system. + name: archlinux-keyring force: true # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. + update_cache: false become: yes when: system_upgrade + register: upgrade - name: upgrade system pacman: @@ -22,14 +24,49 @@ when: upgrade.changed and "linux" in upgrade.packages and system_upgrade become: yes -- name: launch base install software +- name: launch arch base install software pacman: state: present # not required. choices: absent;latest;present. Desired state of the package. - name: "{{system_base_softwares}}" + name: "{{system_base_softwares_arch}}" become: yes + when: ansible_facts['os_family'] == "Archlinux" + + +- name: launch debian base install software + apt: + state: present # not required. choices: absent;latest;present. Desired state of the package. + name: "{{system_base_softwares_debian}}" + update_cache: yes + become: yes + when: ansible_facts['os_family'] == "Debian" - name: install powerline status via pip pip: name: powerline-status # not required. The name of a Python library to install or the url(bzr+,hg+,git+,svn+) of the remote package.,This can be a list (since 2.2) and contain version specifiers (since 2.7). extra_args: --user + +- name: GITHUB | Get current version of bat + shell: > + warn=False + curl --silent https://github.com/sharkdp/bat/releases/latest | + grep 'tag' | + sed -E 's/.*v([0-9].[0-9][0-9].[0-9]).*/\1/' + register: bat_version + failed_when: > + bat_version.rc != 0 or + not bat_version.stdout|regex_search('\w+\.\w+\.\w+') + when: ansible_facts['os_family'] == "Debian" + + +- name: DEBIAN | Set URL to download bins + set_fact: + debian_url: "https://github.com/sharkdp/bat/releases/download/v{{ bat_version.stdout }}/bat_{{ bat_version.stdout }}_amd64.deb" + when: ansible_facts['os_family'] == "Debian" + +- name: DEBIAN | Install deb from github + become: true + apt: + deb: "{{debian_url}}" + when: ansible_facts['os_family'] == "Debian" + diff --git a/tasks/depot_debian.yml b/tasks/depot_debian.yml new file mode 100644 index 0000000..dc30576 --- /dev/null +++ b/tasks/depot_debian.yml @@ -0,0 +1,6 @@ +- name: add repo main contrib + apt_repository: + repo: deb http://ftp.fr.debian.org/debian/ stable main contrib non-free + state: present # not required. choices: absent;present. A source string state. + update_cache: yes # not required. Run the equivalent of C(apt-get update) when a change occurs. Cache updates are run after making changes. + become: yes \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index bbd5ba2..34bbfaa 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,11 @@ ---- - include_tasks: hostname.yml - include_tasks: locales.yml - include_tasks: time.yml - include_tasks: pacman.yml + when: ansible_facts['os_family'] == "Archlinux" +- include_tasks: depot_debian.yml + when: ansible_facts['os_family'] == "Debian" - include_tasks: AUR_builder.yml + when: ansible_facts['os_family'] == "Archlinux" + - include_tasks: base_software.yml \ No newline at end of file