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.

94 lines
1.7 KiB

2 years ago
# 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
2 years ago
register: st
tags:
- git
- install
- dotfiles
- productivity
become: true
become_user: nige
2 years ago
- name: Remove existing .bashrc and dotfolder from home
2 years ago
file:
path: "{{ item }}"
2 years ago
state: absent
# when: st.stat.islnk is not defined
2 years ago
tags:
- git
- install
- dotfiles
- productivity
#become: true
#become_user: nige
loop:
- /home/nige/.bashrc
#- /tmp/main.zip
#- /home/nige/dotfiles
2 years ago
- name: Clone the dotfiles repository
git:
repo: https://git.gerstner.se/nils/ansible_dotfiles.git
dest: /home/nige/dotfiles
force: true
when: st.stat.islnk is not defined
2 years ago
tags:
- git
- install
- dotfiles
- productivity
2 years ago
become: true
become_user: nige
2 years ago
# - 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
2 years ago
- name: Stow the dotfiles
shell: |
stow --verbose 2 --dir "/home/nige/dotfiles" --target "/home/nige/" .
2 years ago
when: st.stat.islnk is not defined
tags:
- git
- install
- dotfiles
- productivity
2 years ago
become: true
become_user: nige
2 years ago
- name: Set the right prompt
ansible.builtin.lineinfile:
path: ~/.bashrc
regexp: '^ENVIRONMENT=.*$'
line: ENVIRONMENT=PROD
tags:
- git
- install
- dotfiles
- productivity
2 years ago
become: true
become_user: nige