Ansible god!

Big rework!
Control stuffs with variables!
We still should do some movei'n around of roles before extending
features.
This commit is contained in:
2022-03-23 02:03:04 +01:00
parent 2c29be1b7b
commit a70d58f3f7
33 changed files with 447 additions and 104 deletions

View File

@@ -0,0 +1,26 @@
- name: Add .aliases
copy: src=aliases.sh dest=/home/{{ name }}/.aliases owner={{ name }} group={{ group }} mode=0644
- name: Add .bat.conf
copy: src=bat.conf dest=/home/{{ name }}/.bat.conf owner={{ name }} group={{ group }} mode=0644
when: "'bat' in packages or 'bat' in extra_packages"
- name: Install zsh syntax highlighting (~/.zshrc.d folder)
when: not zsh_opt_config
git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: /home/{{ name }}/.zshrc.d/zsh-syntax-highlighting
single_branch: yes
version: master
- name: Install zsh syntax highlighting (/opt/zsh folder)
when: zsh_opt_config
git:
repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
dest: /opt/zsh/zsh-syntax-highlighting
single_branch: yes
version: master
become: true
- name: Add ~/.zshrc.d -> /opt/zsh symbolic link
when: zsh_opt_config
file: state=link dest=/home/{{ name }}/.zshrc.d src=/opt/zsh owner={{ name }} group={{ group }} mode=0755
- name: Set owner ship of zsh syntax highlighting files
file: state=directory recurse=yes dest=/home/{{ name }}/.zshrc.d owner={{ name }} group={{ group }}

View File

@@ -0,0 +1,30 @@
- name: Setup user zsh config
when: "'zsh' in setup"
tags: [user,zsh]
block:
- name: Add .zshrc
template: src=zshrc.zsh.j2 dest=/home/{{ name }}/.zshrc owner={{ name }} group={{ group }} mode=0644
- name: Add zsh zstyles config
copy: src=zstyles.zsh dest=/home/{{ name }}/.zstyles owner={{ name }} group={{ group }} mode=0644
- name: Setup user bash config
when: "'bash' in setup"
tags: [user,bash]
block:
- name: Add .bashrc
template: src=bashrc.sh.j2 dest=/home/{{ name }}/.bashrc owner={{ name }} group={{ group }} mode=0644
- name: Setup user extra config
when: "'extra' in setup"
tags: [user,extra]
block:
- import_tasks: extra.yml
- name: Add .env file
when: not revert
copy: src=env.sh dest=/home/{{ name }}/.env owner={{ name }} group={{ group }} mode=0644
- name: Revert ansible shell setup
when: revert
block:
- import_tasks: revert.yml

View File

@@ -0,0 +1,27 @@
- name: Remove user zsh config
tags: [zsh]
block:
- name: Remove .zshrc
file: state=absent path=/home/{{ name }}/.zshrc
- name: Remove zsh zstyles config
file: state=absent path=/home/{{ name }}/.zstyles
- name: Remove .zshrc.d folder/link
file: state=absent path=/home/{{ name }}/.zshrc.d
- name: Remove zsh syntax highlighting
file: state=absent path=/home/{{ name }}/.zshrc.d/zsh-syntax-highlighting
when: not zsh_opt_config
- name: Remove zsh syntax highlighting (/opt/zsh)
file: state=absent path=/opt/zsh/zsh-syntax-highlighting
when: zsh_opt_config
- name: Remove extra user config
when: "'extra' in setup"
tags: [extra]
block:
- name: Remove .aliases
file: state=absent path=/home/{{ name }}/.aliases
- name: Remove .bat.conf
file: state=absent path=/home/{{ name }}/.bat.conf
- name: Remove .env file
file: state=absent path=/home/{{ name }}/.env