Infra/ansible/tasks/omp.yml

76 lines
2.2 KiB
YAML
Raw Normal View History

2022-10-18 22:20:04 +02:00
- name: Install pip package
2022-10-19 00:16:16 +02:00
become: "{{ do_become }}"
2022-10-18 22:20:04 +02:00
ansible.builtin.apt:
name: python3-pip
- name: Install github package
2022-10-19 00:16:16 +02:00
become: "{{ do_become }}"
2022-10-18 22:20:04 +02:00
ansible.builtin.pip:
name: github3.py
2022-04-15 15:51:58 +02:00
- name: Check if OMP is installed
ansible.builtin.stat:
2022-10-19 00:18:29 +02:00
path: /usr/local/bin/oh-my-posh
2022-04-15 15:51:58 +02:00
register: omp_bin
- name: Check OMP version
when: omp_bin.stat.exists
2022-10-19 00:18:29 +02:00
ansible.builtin.command: /usr/local/bin/oh-my-posh --version
changed_when: false
2022-04-15 15:51:58 +02:00
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
2022-10-19 00:18:29 +02:00
when: not omp_bin.stat.exists or omp_latest.tag != ( "v" + omp_ver.stdout )
2022-04-15 15:51:58 +02:00
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
2022-11-08 21:45:32 +01:00
mode: "0755"
2022-10-19 00:18:29 +02:00
force: "yes"
- name: Check if Chezmoi is installed
ansible.builtin.stat:
2022-11-08 21:45:32 +01:00
path: /usr/bin/chezmoi
2022-10-19 00:18:29 +02:00
register: chezmoi_bin
- name: Check Chezmoi version
when: chezmoi_bin.stat.exists
2022-11-08 21:45:32 +01:00
ansible.builtin.command: /usr/bin/chezmoi --version
2022-10-19 00:18:29 +02:00
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 }}"
2022-11-08 21:45:32 +01:00
ansible.builtin.apt:
deb: https://github.com/twpayne/chezmoi/releases/download/{{ chezmoi_latest.tag }}/chezmoi_{{ chezmoi_latest.tag | replace("v","") }}_linux_{{ apt_arch }}.deb
2022-04-15 15:51:58 +02:00
- name: Add OMP to bash
ansible.builtin.lineinfile:
mode: "0644"
path: /home/{{ users.0.username }}/.bashrc
2022-10-19 00:18:29 +02:00
search_string: oh-my-posh
2022-10-18 22:20:04 +02:00
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
2022-04-15 15:51:58 +02:00
create: yes