first commit
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
*-dev.yml
 | 
			
		||||
*-dev
 | 
			
		||||
							
								
								
									
										1740
									
								
								files/.p10k.zsh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1740
									
								
								files/.p10k.zsh
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										11
									
								
								tasks/enable-plugins.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tasks/enable-plugins.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
---
 | 
			
		||||
- name: enable plugins
 | 
			
		||||
  replace:
 | 
			
		||||
    path: "{{ oh_my_zsh_install_folder }}/.zshrc"
 | 
			
		||||
    regexp: "^plugins=\\(((.|\n)*)\\)"
 | 
			
		||||
    replace: "plugins=(\n {{ enable_plugins | join('\n ') }}\n)"
 | 
			
		||||
- name: enable plugins
 | 
			
		||||
  replace:
 | 
			
		||||
    path: "/etc/skel/.zshrc"
 | 
			
		||||
    regexp: "^plugins=\\(((.|\n)*)\\)"
 | 
			
		||||
    replace: "plugins=(\n {{ enable_plugins | join('\n ') }}\n)"
 | 
			
		||||
							
								
								
									
										28
									
								
								tasks/install-powerlevel10k.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								tasks/install-powerlevel10k.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
---
 | 
			
		||||
- name: clone powerlevel10k
 | 
			
		||||
  git:
 | 
			
		||||
    repo: "{{ template_powerlevel10k_repo }}"
 | 
			
		||||
    dest: "{{ oh_my_zsh_install_folder }}/custom/themes/powerlevel10k"
 | 
			
		||||
    depth: 1
 | 
			
		||||
- name: enable powerlevel in template
 | 
			
		||||
  lineinfile:
 | 
			
		||||
    path: "{{ oh_my_zsh_install_folder }}/.zshrc"
 | 
			
		||||
    regex: "^ZSH_THEME="
 | 
			
		||||
    line: 'ZSH_THEME="powerlevel10k/powerlevel10k"'
 | 
			
		||||
- name: enable powerlevel in template
 | 
			
		||||
  lineinfile:
 | 
			
		||||
    path: "{{ oh_my_zsh_install_folder }}/.zshrc"
 | 
			
		||||
    line: '[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh'
 | 
			
		||||
- name: enable powerlevel in skel
 | 
			
		||||
  lineinfile:
 | 
			
		||||
    path: "/etc/skel/.zshrc"
 | 
			
		||||
    regex: "^ZSH_THEME="
 | 
			
		||||
    line: 'ZSH_THEME="powerlevel10k/powerlevel10k"'
 | 
			
		||||
- name: enable powerlevel in template
 | 
			
		||||
  lineinfile:
 | 
			
		||||
    path: "/etc/skel/.zshrc"
 | 
			
		||||
    line: '[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh'
 | 
			
		||||
- name: copy config to skel
 | 
			
		||||
  copy:
 | 
			
		||||
   src: "{{ role_path }}/files/.p10k.zsh"
 | 
			
		||||
   dest: "/etc/skel/.p10k.zsh" 
 | 
			
		||||
							
								
								
									
										5
									
								
								tasks/install-zsh-debian.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								tasks/install-zsh-debian.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Install zsh if not installed
 | 
			
		||||
  apt:
 | 
			
		||||
    name: zsh
 | 
			
		||||
    update_cache: "{{ update_package_cache }}"
 | 
			
		||||
							
								
								
									
										11
									
								
								tasks/install-zsh-plugins.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tasks/install-zsh-plugins.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
---
 | 
			
		||||
- name: clone plugin
 | 
			
		||||
  git:
 | 
			
		||||
    repo: "{{ plugins_zsh[item].git }}"
 | 
			
		||||
    dest: "{{ oh_my_zsh_install_folder }}/custom/plugins/{{ item }}"
 | 
			
		||||
    depth: 1
 | 
			
		||||
  with_items: "{{ plugins }}"
 | 
			
		||||
- name: add plugin to enabled_plugins
 | 
			
		||||
  set_fact:
 | 
			
		||||
    enable_plugins: "{{ enable_plugins + [ item ] }}"
 | 
			
		||||
  with_items: "{{ plugins }}"
 | 
			
		||||
							
								
								
									
										5
									
								
								tasks/install-zsh-ubuntu.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								tasks/install-zsh-ubuntu.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Install zsh if not installed
 | 
			
		||||
  apt:
 | 
			
		||||
    name: zsh
 | 
			
		||||
    update_cache: "{{ update_package_cache }}"
 | 
			
		||||
							
								
								
									
										27
									
								
								tasks/install-zsh.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								tasks/install-zsh.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Install zsh for Debian
 | 
			
		||||
  import_tasks: install-zsh-debian.yml
 | 
			
		||||
  when: ansible_facts['os_family']|lower == 'debian'
 | 
			
		||||
- name: Install zsh for Ubuntu
 | 
			
		||||
  import_tasks: install-zsh-ubuntu.yml
 | 
			
		||||
  when: ansible_facts['os_family']|lower == 'ubuntu'
 | 
			
		||||
- name: check out oh-my-zsh git repository
 | 
			
		||||
  git:
 | 
			
		||||
    repo: "{{ oh_my_zsh_repo }}"
 | 
			
		||||
    dest: "{{ oh_my_zsh_install_folder }}"
 | 
			
		||||
    update: yes
 | 
			
		||||
- name: copy .zsh template to "{{ oh_my_zsh_install_folder }}/.zshrc"
 | 
			
		||||
  copy:
 | 
			
		||||
    src: "{{ oh_my_zsh_install_folder }}/templates/zshrc.zsh-template"
 | 
			
		||||
    dest: "{{ oh_my_zsh_install_folder }}/.zshrc" 
 | 
			
		||||
- name: replace ZSH path in .zshrc
 | 
			
		||||
  lineinfile:
 | 
			
		||||
    path: "{{ oh_my_zsh_install_folder }}/.zshrc"
 | 
			
		||||
    regexp: "^export ZSH="
 | 
			
		||||
    line: "export ZSH={{ oh_my_zsh_install_folder }}"
 | 
			
		||||
- name: hardlink .zshrc to /etc/skel
 | 
			
		||||
  file:
 | 
			
		||||
    src: "{{ oh_my_zsh_install_folder }}/.zshrc"
 | 
			
		||||
    dest: "/etc/skel/.zshrc"
 | 
			
		||||
    state: hard
 | 
			
		||||
    force: true
 | 
			
		||||
							
								
								
									
										37
									
								
								tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
---
 | 
			
		||||
- name: install zsh
 | 
			
		||||
  import_tasks: install-zsh.yml
 | 
			
		||||
- name: set value to enable git plugin
 | 
			
		||||
  set_fact:
 | 
			
		||||
    enable_plugins:
 | 
			
		||||
      - git
 | 
			
		||||
- name: install powerlevel10k
 | 
			
		||||
  import_tasks: install-powerlevel10k.yml
 | 
			
		||||
  when: template is defined and "powerlevel10k" == template
 | 
			
		||||
- name: include tasks
 | 
			
		||||
  import_tasks: install-zsh-plugins.yml
 | 
			
		||||
- name: enable plugins
 | 
			
		||||
  import_tasks: enable-plugins.yml
 | 
			
		||||
- name: active zsh for users
 | 
			
		||||
  user:
 | 
			
		||||
    name: "{{ item }}"
 | 
			
		||||
    shell: /bin/zsh
 | 
			
		||||
  with_items: "{{ users }}"
 | 
			
		||||
  register: user
 | 
			
		||||
- name: copy .zsh template to userhome .zshrc"
 | 
			
		||||
  copy:
 | 
			
		||||
    src: "/etc/skel/.zshrc"
 | 
			
		||||
    dest: "{{ item.home }}/.zshrc" 
 | 
			
		||||
  with_items: "{{user.results}}"
 | 
			
		||||
- name: copy .zsh template to userhome .zshrc"
 | 
			
		||||
  copy:
 | 
			
		||||
    src: "/etc/skel/.p10k.zsh"
 | 
			
		||||
    dest: "{{ item.home }}/.p10k.zsh" 
 | 
			
		||||
  with_items: "{{user.results}}"
 | 
			
		||||
  when: template is defined and "powerlevel10k" == template
 | 
			
		||||
- name: copy config to skel
 | 
			
		||||
  copy:
 | 
			
		||||
   src: "{{ role_path }}/files/.p10k.zsh"
 | 
			
		||||
   dest: "/etc/skel/.p10k.zsh" 
 | 
			
		||||
  with_items: "{{user.results}}"
 | 
			
		||||
  when: template is defined and "powerlevel10k" == template
 | 
			
		||||
							
								
								
									
										10
									
								
								vars/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								vars/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
---
 | 
			
		||||
update_package_cache: yes
 | 
			
		||||
oh_my_zsh_repo: "https://github.com/ohmyzsh/ohmyzsh.git"
 | 
			
		||||
oh_my_zsh_install_folder: "/usr/share/oh-my-zsh"
 | 
			
		||||
template_powerlevel10k_repo: "https://github.com/romkatv/powerlevel10k.git"
 | 
			
		||||
plugins_zsh:
 | 
			
		||||
  zsh-syntax-highlighting:
 | 
			
		||||
    git: "https://github.com/zsh-users/zsh-syntax-highlighting.git"
 | 
			
		||||
  zsh-autosuggestions:
 | 
			
		||||
    git: "https://github.com/zsh-users/zsh-autosuggestions"
 | 
			
		||||
		Reference in New Issue
	
	Block a user