Infra/ansible/tasks/omp.yml
2022-10-19 00:18:29 +02:00

79 lines
2.2 KiB
YAML

- name: Install pip package
become: "{{ do_become }}"
ansible.builtin.apt:
name: python3-pip
- name: Install github package
become: "{{ do_become }}"
ansible.builtin.pip:
name: github3.py
- name: Check if OMP is installed
ansible.builtin.stat:
path: /usr/local/bin/oh-my-posh
register: omp_bin
- name: Check OMP version
when: omp_bin.stat.exists
ansible.builtin.command: /usr/local/bin/oh-my-posh --version
changed_when: false
register: omp_ver
- name: Get latest release of OMP
community.general.github_release:
user: JanDeDobbeleer
repo: oh-my-posh
action: latest_release
register: omp_latest
- name: Download OMP
when: not omp_bin.stat.exists or omp_latest.tag != ( "v" + omp_ver.stdout )
become: "{{ do_become }}"
ansible.builtin.get_url:
url: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/{{ omp_latest.tag }}/posh-linux-{{ apt_arch }}
dest: /usr/local/bin/oh-my-posh
mode: "0744"
force: "yes"
- name: Check if Chezmoi is installed
ansible.builtin.stat:
path: /usr/local/bin/chezmoi
register: chezmoi_bin
- name: Check Chezmoi version
when: chezmoi_bin.stat.exists
ansible.builtin.command: /usr/local/bin/chezmoi --version
changed_when: false
register: chezmoi_ver
- name: Get latest release of Chezmoi
community.general.github_release:
user: twpayne
repo: chezmoi
action: latest_release
register: chezmoi_latest
- name: Download Chezmoi
when: not chezmoi_bin.stat.exists or chezmoi_latest.tag.split(",")[0] != ( "chezmoi version v" + chezmoi_ver.stdout )
become: "{{ do_become }}"
ansible.builtin.get_url:
url: https://github.com/twpayne/chezmoi/releases/download/{{ chezmoi_latest.tag }}/chezmoi-linux-{{ apt_arch }}
dest: /usr/local/bin/chezmoi
mode: "0744"
force: "yes"
- name: Add OMP to bash
ansible.builtin.lineinfile:
mode: "0644"
path: /home/{{ users.0.username }}/.bashrc
search_string: oh-my-posh
line: eval "$(oh-my-posh init bash --config https://gist.github.com/Roxedus/6a11a5dbd37c24ecacf02fb9aef06e15/raw)"
create: yes
- name: Basic VI
ansible.builtin.lineinfile:
mode: "0644"
path: /home/{{ users.0.username }}/.vimrc
line: set nocompatible
create: yes