You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

---
- name: Install zsh
hosts: localhost
connection: local
become: false
vars:
uid: "{{ lookup('env','USER') }}"
tasks:
- name: Have zsh installed allready
stat:
path: "/home/{{ uid }}/.oh-my-zsh"
register: ohmyzsh
- name: Set zsh as default shell
become: true
ansible.builtin.command:
cmd: chsh -s /usr/bin/zsh {{ uid }}
when: not ohmyzsh.stat.exists
- name: Get Oh my zsh
ansible.builtin.command:
chdir: /tmp
cmd: wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
creates: /tmp/install.sh
when: not ohmyzsh.stat.exists
- name: Install Oh my zsh
ansible.builtin.command:
cmd: bash /tmp/install.sh
creates: /home/{{ uid }}/.oh-my-zsh
when: not ohmyzsh.stat.exists
- name: Remove Oh my zsh install script
ansible.builtin.command:
cmd: rm /tmp/install.sh
removes: /tmp/install.sh
when: not ohmyzsh.stat.exists
- name: Install zshrc
ansible.builtin.template:
src: ../templates/zshrc.j2
dest: "/home/{{ uid }}/.zshrc"
owner: "{{ uid }}"
group: "{{ uid }}"
mode: '0644'