|
|
|
# tasks/dotfiles.yaml
|
|
|
|
- name: Install stow
|
|
|
|
become: true
|
|
|
|
apt:
|
|
|
|
name: [ "stow" ]
|
|
|
|
tags:
|
|
|
|
- git
|
|
|
|
- install
|
|
|
|
- dotfiles
|
|
|
|
- productivity
|
|
|
|
|
|
|
|
- name: Check if already stowed
|
|
|
|
stat:
|
|
|
|
path: /home/nige/.stowed
|
|
|
|
register: st
|
|
|
|
tags:
|
|
|
|
- git
|
|
|
|
- install
|
|
|
|
- dotfiles
|
|
|
|
- productivity
|
|
|
|
become: true
|
|
|
|
become_user: nige
|
|
|
|
|
|
|
|
- name: Remove existing .bashrc and dotfolder from home
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
# when: st.stat.islnk is not defined
|
|
|
|
tags:
|
|
|
|
- git
|
|
|
|
- install
|
|
|
|
- dotfiles
|
|
|
|
- productivity
|
|
|
|
become: true
|
|
|
|
become_user: nige
|
|
|
|
loop:
|
|
|
|
- /home/nige/.bashrc
|
|
|
|
- /tmp/main.zip
|
|
|
|
#- /home/nige/dotfiles
|
|
|
|
|
|
|
|
- name: Clone the dotfiles repository
|
|
|
|
git:
|
|
|
|
repo: https://git.gerstner.se/nils/ansible_dotfiles.git
|
|
|
|
dest: /home/nige/dotfiles
|
|
|
|
when: st.stat.islnk is not defined
|
|
|
|
tags:
|
|
|
|
- git
|
|
|
|
- install
|
|
|
|
- dotfiles
|
|
|
|
- productivity
|
|
|
|
become: true
|
|
|
|
become_user: nige
|
|
|
|
|
|
|
|
# - name: Move dotfiles to dest folder
|
|
|
|
# ansible.builtin.copy:
|
|
|
|
# src: /tmp/ansible/dotfiles
|
|
|
|
# dest: ~/
|
|
|
|
# remote_src: yes
|
|
|
|
# owner: root
|
|
|
|
# group: root
|
|
|
|
# # mode: u+rw,g-wx,o-rwx
|
|
|
|
# # validate: /usr/sbin/visudo -csf %s
|
|
|
|
# tags:
|
|
|
|
# - git
|
|
|
|
# - install
|
|
|
|
# - dotfiles
|
|
|
|
# - productivity
|
|
|
|
|
|
|
|
- name: Stow the dotfiles
|
|
|
|
shell: 'stow --verbose 2 --dir "/home/nige/dotfiles" --target "/home/nige/ .'
|
|
|
|
when: st.stat.islnk is not defined
|
|
|
|
tags:
|
|
|
|
- git
|
|
|
|
- install
|
|
|
|
- dotfiles
|
|
|
|
- productivity
|
|
|
|
become: true
|
|
|
|
become_user: nige
|
|
|
|
|
|
|
|
- name: Set the right prompt
|
|
|
|
ansible.builtin.lineinfile:
|
|
|
|
path: ~/.bashrc
|
|
|
|
regexp: '^ENVIRONMENT=.*$'
|
|
|
|
line: ENVIRONMENT=PROD
|
|
|
|
tags:
|
|
|
|
- git
|
|
|
|
- install
|
|
|
|
- dotfiles
|
|
|
|
- productivity
|
|
|
|
become: true
|
|
|
|
become_user: nige
|