aboutsummaryrefslogtreecommitdiffstats
path: root/src/setup.yaml
blob: 553426712d7a13b244dc96511d96ee87ddda2b05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
- name: Playbook to manage personal dotfiles
  hosts: localhost
  connection: local
  tasks:
    - name: Create folders
      file:
        path: "{{item}}"
        state: directory
      loop:
        - "$HOME/src"
        - "$HOME/bin"
        - "$HOME/Pictures"

    - name: Link wallpaper
      file:
        src: "{{ playbook_dir }}/wallpaper.jpg"
        dest: "$HOME/Pictures/wallpaper.jpg"
        state: link

    - include_tasks: tasks/shared_dotfiles.yaml

    - include_tasks: tasks/dnf_packages.yaml
      when: ansible_os_family == "RedHat"

    - include_tasks: tasks/pkg_packages.yaml
      when: ansible_os_family == "FreeBSD"

    - include_tasks: tasks/desktop.yaml
      when: ansible_os_family == "FreeBSD"

    - name: Ensure user is setup correctly
      become: yes
      become_method: su
      ansible.builtin.user:
        name: eugene
        groups: wheel,vboxusers,operator
        state: present
        generate_ssh_key: yes
        ssh_key_bits: 2048
        ssh_key_file: $HOME/.ssh/id_rsa

    - name: Ensure shell is set to zsh
      vars:
        current_user: "{{ ansible_user_id }}"
      become: yes
      become_method: su
      user:
        name: "{{ current_user }}"
        shell: /usr/local/bin/zsh

    - name: Install vim-plug
      get_url:
        url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
        dest: "$HOME/.config/nvim/autoload/plug.vim"

    - name: Install vim-plug plugins
      shell: nvim +PlugInstall +qall --headless