Files
dotfiles/ansible/roles/cheat/tasks/main.yml
2024-02-25 21:16:00 +01:00

62 lines
1.9 KiB
YAML

- name: Install glow
become: true
shell: go install github.com/charmbracelet/glow@latest
environment:
GOPATH: "{{ go_path }}"
register: glow
changed_when: glow.stdout
when: result is succeeded
- debug: var=glow verbosity=2
- name: Install cheat
become: true
shell: go install github.com/cheat/cheat/cmd/cheat@latest
environment:
GOPATH: "{{ go_path }}"
register: cheat
changed_when: cheat.stdout
when: result is succeeded
- debug: var=cheat verbosity=2
- name: Create required folders
file:
state: directory
dest: "{{ lookup('env', 'XDG_CONFIG_HOME') }}/{{ item.path }}"
with_filetree: ../templates
when: item.state == 'directory'
- name: Install glow config files
template:
src: "{{ item.src }}"
dest: "{{ lookup('env', 'XDG_CONFIG_HOME') }}/glow/{{ item.path }}"
owner: "{{ ansible_user_uid }}"
group: "{{ ansible_user_gid }}"
mode: '{{ item.mode }}'
with_filetree: templates/glow/
- name: Install cheat config files
template:
src: "{{ item.src }}"
dest: "{{ lookup('env', 'XDG_CONFIG_HOME') }}/cheat/{{ item.path }}"
owner: "{{ ansible_user_uid }}"
group: "{{ ansible_user_gid }}"
mode: '{{ item.mode }}'
with_filetree: templates/cheat/
- name: Add to .zshrc
lineinfile:
path: "{{ ansible_user_dir }}/.zshrc"
insertafter: '\[ -f {{ lookup("env", "XDG_CONFIG_HOME") }}.* \] && source {{ lookup("env", "XDG_CONFIG_HOME") }}.*'
regexp: '\[ -f {{ lookup("env", "XDG_CONFIG_HOME") }}/cheat/cheat\.zsh \] && source {{ lookup("env", "XDG_CONFIG_HOME") }}/cheat/cheat\.zsh'
line: '[ -f {{ lookup("env", "XDG_CONFIG_HOME") }}/cheat/cheat.zsh ] && source {{ lookup("env", "XDG_CONFIG_HOME") }}/cheat/cheat.zsh'
- name: Download Cheatsheets
git:
accept_newhostkey: true
repo: 'git@git.cbeck.tech:kamu/cheatsheets.git'
dest: "{{ lookup('env', 'XDG_CONFIG_HOME') }}/cheat/cheatsheets"
environment:
GIT_GERMINAL_PROMPT: 0