2024-09-05 02:56:43 +00:00
|
|
|
---
|
|
|
|
- name: installs and setups dotfiles and packages
|
|
|
|
hosts: localhost
|
|
|
|
tasks:
|
|
|
|
- name: test loops
|
|
|
|
debug:
|
|
|
|
msg: "{{ ansible_os_family }}"
|
|
|
|
- name: install packages on a debian host
|
|
|
|
apt:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: latest
|
|
|
|
loop:
|
|
|
|
- vim-nox
|
|
|
|
- git
|
|
|
|
- stow
|
|
|
|
- curl
|
|
|
|
- ranger
|
|
|
|
- tmux
|
|
|
|
when: ansible_os_family == "Debian"
|
|
|
|
become: yes
|
2024-09-28 22:12:43 +00:00
|
|
|
become_user: root
|
2024-09-05 02:56:43 +00:00
|
|
|
|
|
|
|
- name: install packages on redhat host
|
|
|
|
dnf:
|
|
|
|
name:
|
|
|
|
- vim-enhanced
|
|
|
|
- git
|
|
|
|
- stow
|
|
|
|
- curl
|
|
|
|
- ranger
|
|
|
|
- tmux
|
|
|
|
state: latest
|
|
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
become: yes
|
2024-09-28 22:12:43 +00:00
|
|
|
become_user: root
|
|
|
|
|
|
|
|
- name: copy old bash configs to ...bak
|
|
|
|
copy:
|
|
|
|
src: "/home/{ansible_user_id}/{item}"
|
|
|
|
dest: "/home/{ansible_user_id}/{item}.bak"
|
|
|
|
loop:
|
|
|
|
- ".bashrc"
|
|
|
|
- ".bash_profile"
|
|
|
|
|
|
|
|
- name: delete old configs
|
|
|
|
file:
|
|
|
|
path: "/home/{ansible_user_id}/{item}"
|
|
|
|
state: absent
|
|
|
|
loop:
|
|
|
|
- ".bashrc"
|
|
|
|
- ".bash_profile"
|
2024-09-05 02:56:43 +00:00
|
|
|
|
|
|
|
- name: link the dotfiles to users home directory
|
|
|
|
command:
|
|
|
|
cmd: stow "{{ item }}"
|
|
|
|
loop:
|
|
|
|
- bash
|
|
|
|
- git
|
|
|
|
- ranger
|
|
|
|
- shellenv
|
|
|
|
- tmux
|
|
|
|
- vim
|