diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2022-09-04 17:02:35 -0400 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2022-09-04 17:02:35 -0400 |
| commit | 9cbca7991457b05bcfcc5017060437dd3af489a5 (patch) | |
| tree | cebeeaebd4ad613bea739db8fadc1d630f43724f /roles | |
| parent | Add bsd updates (diff) | |
| download | dotfiles-9cbca7991457b05bcfcc5017060437dd3af489a5.zip | |
Convert from src/ to roles structure
Diffstat (limited to '')
| -rw-r--r-- | roles/1password/tasks/main.yaml | 24 | ||||
| -rw-r--r-- | roles/fonts/tasks/main.yaml | 13 | ||||
| -rw-r--r-- | roles/pyenv/tasks/main.yaml | 46 | ||||
| -rw-r--r-- | roles/pyenv/vars/main.yaml | 2 | ||||
| -rw-r--r-- | roles/user/files/.gdbinit (renamed from src/configs/shared/.gdbinit) | 0 | ||||
| -rw-r--r-- | roles/user/files/.gitconfig (renamed from src/configs/shared/.gitconfig) | 2 | ||||
| -rw-r--r-- | roles/user/files/.tmux.conf (renamed from src/configs/shared/.tmux.conf) | 0 | ||||
| -rw-r--r-- | roles/user/files/wallpaper.jpg (renamed from src/wallpaper.jpg) | bin | 26719295 -> 26719295 bytes | |||
| -rw-r--r-- | roles/user/tasks/main.yaml | 43 | ||||
| -rw-r--r-- | roles/vim/files/init.vim (renamed from src/configs/shared/nvim/init.vim) | 0 | ||||
| -rw-r--r-- | roles/vim/tasks/main.yaml | 35 | ||||
| -rw-r--r-- | roles/vscode/tasks/main.yaml | 24 | ||||
| -rw-r--r-- | roles/zsh/files/.zshrc (renamed from src/configs/shared/.zshrc) | 7 | ||||
| -rw-r--r-- | roles/zsh/tasks/main.yaml | 38 |
14 files changed, 230 insertions, 4 deletions
diff --git a/roles/1password/tasks/main.yaml b/roles/1password/tasks/main.yaml new file mode 100644 index 0000000..88fe964 --- /dev/null +++ b/roles/1password/tasks/main.yaml @@ -0,0 +1,24 @@ +--- +- name: Import 1Password key + become: yes + ansible.builtin.rpm_key: + state: present + key: https://downloads.1password.com/linux/keys/1password.asc + +- name: Add 1Password YUM Repo + become: yes + yum_repository: + name: 1password + description: 1Password Stable Channel + baseurl: https://downloads.1password.com/linux/rpm/stable/$basearch + enabled: yes + gpgcheck: yes + repo_gpgcheck: yes + gpgkey: https://downloads.1password.com/linux/keys/1password.asc + state: present + +- name: Install + become: yes + dnf: + name: 1password + state: present diff --git a/roles/fonts/tasks/main.yaml b/roles/fonts/tasks/main.yaml new file mode 100644 index 0000000..f042c5d --- /dev/null +++ b/roles/fonts/tasks/main.yaml @@ -0,0 +1,13 @@ +--- +- name: Add Hack font COPR repo + become: yes + community.general.copr: + host: copr.fedorainfracloud.org + state: enabled + name: zawertun/hack-fonts + +- name: Install + become: yes + dnf: + name: hack-fonts + state: present diff --git a/roles/pyenv/tasks/main.yaml b/roles/pyenv/tasks/main.yaml new file mode 100644 index 0000000..7a20c78 --- /dev/null +++ b/roles/pyenv/tasks/main.yaml @@ -0,0 +1,46 @@ +--- +- name: Install build requirements + become: yes + + dnf: + name: "{{ item.key }}" + state: "{{ item.value.state | default('present') }}" + + with_dict: "{{dnf}}" + vars: + dnf: + make: + gcc: + zlib-devel: + bzip2: + bzip2-devel: + readline-devel: + sqlite: + sqlite-devel: + openssl-devel: + tk-devel: + libffi-devel: + xz-devel: + +- name: Download + ansible.builtin.git: + repo: https://github.com/pyenv/pyenv.git + dest: "{{ lookup('env', 'HOME') }}/.pyenv" + version: v2.3.4 + +- name: "Ensure shell startup file sets up correct environment" + lineinfile: + path: "{{ shell_startup_file_path }}" + line: "{{ item.value.line }}" + state: present + + with_dict: "{{lines}}" + vars: + # Assumption: This will only work for certain shells (like zsh, bash, etc.) + lines: + pyenv_root: + line: export PYENV_ROOT="$HOME/.pyenv" + export_pyenv_bin: + line: command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" + pyenv_init: + line: eval "$(pyenv init -)" diff --git a/roles/pyenv/vars/main.yaml b/roles/pyenv/vars/main.yaml new file mode 100644 index 0000000..1b89247 --- /dev/null +++ b/roles/pyenv/vars/main.yaml @@ -0,0 +1,2 @@ +--- +shell_startup_file_path: "{{ lookup('env', 'HOME') }}/.zshrc" diff --git a/src/configs/shared/.gdbinit b/roles/user/files/.gdbinit index 9422460..9422460 100644 --- a/src/configs/shared/.gdbinit +++ b/roles/user/files/.gdbinit diff --git a/src/configs/shared/.gitconfig b/roles/user/files/.gitconfig index ccb1919..1086dfa 100644 --- a/src/configs/shared/.gitconfig +++ b/roles/user/files/.gitconfig @@ -18,5 +18,3 @@ defaultBranch = main [commit] gpgsign = true - - diff --git a/src/configs/shared/.tmux.conf b/roles/user/files/.tmux.conf index 207d7e8..207d7e8 100644 --- a/src/configs/shared/.tmux.conf +++ b/roles/user/files/.tmux.conf diff --git a/src/wallpaper.jpg b/roles/user/files/wallpaper.jpg Binary files differindex 94ae4cf..94ae4cf 100644 --- a/src/wallpaper.jpg +++ b/roles/user/files/wallpaper.jpg diff --git a/roles/user/tasks/main.yaml b/roles/user/tasks/main.yaml new file mode 100644 index 0000000..802d8c6 --- /dev/null +++ b/roles/user/tasks/main.yaml @@ -0,0 +1,43 @@ +--- +- name: Link dotfiles + file: + src: "{{ item.value.src }}" + dest: "{{ item.value.dest }}" + state: link + with_dict: "{{dotfiles}}" + vars: + dotfiles: + gitconfig: + src: "{{ role_path }}/files/.gitconfig" + dest: "{{ lookup('env', 'HOME') }}/.gitconfig" + gdbinit: + src: "{{ role_path }}/files/.gdbinit" + dest: "{{ lookup('env', 'HOME') }}/.gdbinit" + tmux: + src: "{{ role_path }}/files/.tmux.conf" + dest: "{{ lookup('env', 'HOME') }}/.tmux.conf" + +- name: Link wallpaper + file: + src: "{{ role_path }}/files/wallpaper.jpg" + dest: "$HOME/Pictures/wallpaper.jpg" + state: link + +- name: Install general packages + become: yes + + dnf: + name: "{{ item.key }}" + state: "{{ item.value.state | default('present') }}" + + with_dict: "{{dnf}}" + vars: + dnf: + "@Development tools": + curl: + firefox: + git: + openssl: + ripgrep: + rsync: + wget: diff --git a/src/configs/shared/nvim/init.vim b/roles/vim/files/init.vim index 0c98b73..0c98b73 100644 --- a/src/configs/shared/nvim/init.vim +++ b/roles/vim/files/init.vim diff --git a/roles/vim/tasks/main.yaml b/roles/vim/tasks/main.yaml new file mode 100644 index 0000000..0609f9b --- /dev/null +++ b/roles/vim/tasks/main.yaml @@ -0,0 +1,35 @@ +--- +- name: Create folders + file: + path: "{{ lookup('env', 'HOME') }}/.config/nvim/autoload" + state: directory + +- name: Link configuration + file: + src: "{{ role_path }}/files/init.vim" + dest: "{{ lookup('env', 'HOME') }}/.config/nvim/init.vim" + state: link + +- name: Install packages + become: yes + + dnf: + name: "{{ item.key }}" + state: "{{ item.value.state | default('present') }}" + + with_dict: "{{packages}}" + vars: + packages: + python: + python-devel: + python-neovim: + vim: + neovim: + +- 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 diff --git a/roles/vscode/tasks/main.yaml b/roles/vscode/tasks/main.yaml new file mode 100644 index 0000000..476ccc9 --- /dev/null +++ b/roles/vscode/tasks/main.yaml @@ -0,0 +1,24 @@ +--- +- name: Import Microsoft Key + become: yes + ansible.builtin.rpm_key: + state: present + key: https://packages.microsoft.com/keys/microsoft.asc + +- name: Add YUM Repo + become: yes + yum_repository: + name: vscode + description: Visual Studio Code + baseurl: https://packages.microsoft.com/yumrepos/vscode + enabled: yes + gpgcheck: yes + repo_gpgcheck: yes + gpgkey: https://packages.microsoft.com/keys/microsoft.asc + state: present + +- name: Install + become: yes + dnf: + name: code + state: present diff --git a/src/configs/shared/.zshrc b/roles/zsh/files/.zshrc index 53ff1ac..fdc75f0 100644 --- a/src/configs/shared/.zshrc +++ b/roles/zsh/files/.zshrc @@ -18,7 +18,6 @@ export SRC_DIR="$HOME/src" export BIN_DIR="$HOME/bin" export PATH="$HOME/.poetry/bin:$PATH" -export PATH="$HOME/.pyenv/bin:$PATH" export PATH=$PATH:$GOPATH/bin export PATH=$PATH:$GOROOT/bin export PATH="$PATH:$HOME/.local/bin" @@ -27,6 +26,10 @@ export PATH="$BIN_DIR:$PATH" export GOPATH=$SRC_DIR/go export GOBIN=$SRC_DIR/go/bin +export PYENV_ROOT="$HOME/.pyenv" +command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init -)" + alias gs="git status" alias gc="git commit" alias ga="git add" @@ -75,5 +78,5 @@ gocover() { } ip() { - ifconfig | jc --ifconfig | jq '.[] | select(.name=="em0") | {ipv4_addr, ipv6_addr}' + ifconfig | jc --ifconfig | jq '.[] | select(.name=="wlo1") | {ipv4_addr, ipv6_addr}' } diff --git a/roles/zsh/tasks/main.yaml b/roles/zsh/tasks/main.yaml new file mode 100644 index 0000000..fe0c039 --- /dev/null +++ b/roles/zsh/tasks/main.yaml @@ -0,0 +1,38 @@ +--- +- name: Install packages + become: yes + + dnf: + name: "{{ item.key }}" + state: "{{ item.value.state | default('present') }}" + + with_dict: "{{dnf}}" + vars: + dnf: + fzf: + git: + jq: + jc: + zsh: + +- name: Ensure shell is default for user + vars: + current_user: "{{ ansible_user_id }}" + become: yes + user: + name: "{{ current_user }}" + shell: /usr/bin/zsh + +- name: Link configuration + file: + src: "{{ role_path }}/files/.zshrc" + dest: "{{ lookup('env', 'HOME') }}/.zshrc" + state: link + +- name: Create folders + file: + path: "{{item}}" + state: directory + loop: + - "{{ lookup('env', 'HOME') }}/src" + - "{{ lookup('env', 'HOME') }}/bin" |