From 85f0dd88705fdd21d0332d6c9fd16d5553230880 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sun, 31 May 2020 17:27:58 +0200 Subject: [PATCH] Split misc role into actual steps --- roles/dotfiles/tasks/main.yaml | 16 ++++++++++ roles/git/tasks/main.yaml | 14 +++++++++ roles/misc/tasks/main.yaml | 47 ------------------------------ roles/oh-my-zsh/tasks/main.yaml | 13 --------- roles/tmux/tasks/main.yaml | 22 ++++++++++++++ roles/user-account/tasks/main.yaml | 8 ----- roles/zsh/tasks/main.yaml | 25 ++++++++++++++++ wsl-debian.yaml | 13 +++++++-- 8 files changed, 88 insertions(+), 70 deletions(-) create mode 100644 roles/dotfiles/tasks/main.yaml create mode 100644 roles/git/tasks/main.yaml delete mode 100644 roles/misc/tasks/main.yaml delete mode 100644 roles/oh-my-zsh/tasks/main.yaml create mode 100644 roles/tmux/tasks/main.yaml create mode 100644 roles/zsh/tasks/main.yaml diff --git a/roles/dotfiles/tasks/main.yaml b/roles/dotfiles/tasks/main.yaml new file mode 100644 index 0000000..ba60d84 --- /dev/null +++ b/roles/dotfiles/tasks/main.yaml @@ -0,0 +1,16 @@ +--- +- name: install required packages + package: + name: + - git + state: latest + +- name: clone dotfiles + become_user: "{{ account.name }}" + git: + repo: git@github.com:mandlm/dotfiles.git + dest: "{{ dotfiles }}" + accept_hostkey: yes + update: no + + diff --git a/roles/git/tasks/main.yaml b/roles/git/tasks/main.yaml new file mode 100644 index 0000000..52f4901 --- /dev/null +++ b/roles/git/tasks/main.yaml @@ -0,0 +1,14 @@ +--- +- name: install required packages + package: + name: + - git + state: latest + +- name: install git config + become_user: "{{ account.name }}" + shell: + chdir: "{{ dotfiles }}/git" + cmd: ./install.sh + creates: "{{ account.home }}/.gitconfig" + diff --git a/roles/misc/tasks/main.yaml b/roles/misc/tasks/main.yaml deleted file mode 100644 index 62ea42e..0000000 --- a/roles/misc/tasks/main.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- name: install basic packages - package: - name: - - aptitude - - git - - tmux - - tree - state: latest - -- name: clone dotfiles - become_user: "{{ account.name }}" - git: - repo: git@github.com:mandlm/dotfiles.git - dest: "{{ dotfiles }}" - accept_hostkey: yes - update: no - -- name: install zsh config - become_user: "{{ account.name }}" - shell: - chdir: "{{ dotfiles }}/zsh" - cmd: ./install.sh - creates: "{{ account.home }}/.zshrc" - -- name: install tmux plugin manager - become_user: "{{ account.name }}" - git: - repo: https://github.com/tmux-plugins/tpm.git - dest: "{{ account.home }}/.tmux/plugins/tpm" - accept_hostkey: yes - update: no - -- name: install tmux config - become_user: "{{ account.name }}" - shell: - chdir: "{{ dotfiles }}/tmux" - cmd: ./install.sh - creates: "{{ account.home }}/.tmux.conf" - -- name: install git config - become_user: "{{ account.name }}" - shell: - chdir: "{{ dotfiles }}/git" - cmd: ./install.sh - creates: "{{ account.home }}/.gitconfig" - diff --git a/roles/oh-my-zsh/tasks/main.yaml b/roles/oh-my-zsh/tasks/main.yaml deleted file mode 100644 index 2b34d6f..0000000 --- a/roles/oh-my-zsh/tasks/main.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: install required packages - package: - name: - - curl - state: latest - -- name: install oh-my-zsh - become_user: "{{ account.name }}" - shell: - cmd: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --keep-zshrc" - creates: "{{ account.home }}/.oh-my-zsh" - diff --git a/roles/tmux/tasks/main.yaml b/roles/tmux/tasks/main.yaml new file mode 100644 index 0000000..bd9e7f3 --- /dev/null +++ b/roles/tmux/tasks/main.yaml @@ -0,0 +1,22 @@ +--- +- name: install required packages + package: + name: + - tmux + state: latest + +- name: install tmux plugin manager + become_user: "{{ account.name }}" + git: + repo: https://github.com/tmux-plugins/tpm.git + dest: "{{ account.home }}/.tmux/plugins/tpm" + accept_hostkey: yes + update: no + +- name: install tmux config + become_user: "{{ account.name }}" + shell: + chdir: "{{ dotfiles }}/tmux" + cmd: ./install.sh + creates: "{{ account.home }}/.tmux.conf" + diff --git a/roles/user-account/tasks/main.yaml b/roles/user-account/tasks/main.yaml index 8dc9048..813028a 100644 --- a/roles/user-account/tasks/main.yaml +++ b/roles/user-account/tasks/main.yaml @@ -1,18 +1,10 @@ --- -- name: install required packages - package: - name: - - zsh - state: latest - - name: setup user account user: name: "{{ username }}" password: "{{ password }}" generate_ssh_key: yes create_home: yes - shell: /usr/bin/zsh state: present update_password: always register: account - diff --git a/roles/zsh/tasks/main.yaml b/roles/zsh/tasks/main.yaml new file mode 100644 index 0000000..2157f07 --- /dev/null +++ b/roles/zsh/tasks/main.yaml @@ -0,0 +1,25 @@ +--- +- name: install required packages + package: + name: + - curl + - zsh + state: latest + +- name: install zsh config + become_user: "{{ account.name }}" + shell: + chdir: "{{ dotfiles }}/zsh" + cmd: ./install.sh + creates: "{{ account.home }}/.zshrc" + +- name: install oh-my-zsh + become_user: "{{ account.name }}" + shell: + cmd: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --unattended --keep-zshrc" + creates: "{{ account.home }}/.oh-my-zsh" + +- name: change login shell to zsh + user: + name: "{{ username }}" + shell: /usr/bin/zsh diff --git a/wsl-debian.yaml b/wsl-debian.yaml index b6e69e8..65e8116 100644 --- a/wsl-debian.yaml +++ b/wsl-debian.yaml @@ -10,6 +10,15 @@ - update-packages - user-account - github-auth - - misc - - oh-my-zsh + - dotfiles + - git + - tmux + - zsh - neovim + tasks: + - name: install tools + package: + name: + - aptitude + - tree + state: latest