diff --git a/install.sh b/install.sh index a7db926..9ac8e30 100755 --- a/install.sh +++ b/install.sh @@ -14,9 +14,9 @@ fi "${SUDO}" apt-add-repository --yes --update ppa:ansible/ansible "${SUDO}" apt install -y git ansible -if [ ! -d "${HOME}/src/ansible-desktop" ]; then - mkdir -p "${HOME}/src" - cd "${HOME}/src" +if [ ! -d "${HOME}/src/desktop/ansible-desktop" ]; then + mkdir -p "${HOME}/src/desktop/" + cd "${HOME}/src/desktop/" git clone "$ANSIBLE_REPO" fi cd "${HOME}/src/ansible-desktop" diff --git a/localhost.yml b/localhost.yml index 8669496..e4d5487 100644 --- a/localhost.yml +++ b/localhost.yml @@ -1,20 +1,22 @@ --- - hosts: localhost roles: - - dwm - ubuntu - - firefox - - docker - - dotfiles - - java - - jetbrains - - signal - - virtual - - lutris - - ego - - laptop - - prusa-slicer - - intellij - - chromium - - terraform - - no-snap +# - dwm +# - firefox +# - docker +# - dotfiles +# - java +# - jetbrains +# - signal +# - virtual +# - lutris +# - ego +# - laptop +# - prusa-slicer +# - intellij +# - chromium +# - terraform +# - no-snap + vars: + desktop_src_dir: {{ ansible_user_dir }}/src/desktop \ No newline at end of file diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml index 0d21dff..630f705 100644 --- a/roles/dotfiles/tasks/main.yml +++ b/roles/dotfiles/tasks/main.yml @@ -7,15 +7,10 @@ - git - make -- name: create src dir - file: - path: ~/src - state: directory - - name: checkout dotfiles git: repo: "{{ dotfiles.repo }}" - dest: "{{ ansible_user_dir }}/src/dotfiles" + dest: "{{ desktop_src_dir }}/dotfiles" clone: yes update: yes @@ -27,4 +22,4 @@ - name: install make: target: install - chdir: "{{ ansible_user_dir }}/src/dotfiles" + chdir: "{{ desktop_src_dir }}/dotfiles" diff --git a/roles/dwm/tasks/dwm.yml b/roles/dwm/tasks/dwm.yml index 886a823..4054a63 100644 --- a/roles/dwm/tasks/dwm.yml +++ b/roles/dwm/tasks/dwm.yml @@ -15,21 +15,16 @@ - libx11-xcb-dev - libyajl-dev -- name: create src dir - file: - path: ~/src - state: directory - - name: checkout dwm git: repo: "{{ dwm.repo }}" - dest: "{{ ansible_user_dir }}/src/dwm" + dest: "{{ desktop_src_dir }}/dwm" clone: yes update: yes - name: build dwm make: - chdir: "{{ ansible_user_dir }}/src/dwm" + chdir: "{{ desktop_src_dir }}/dwm" - name: copy xsession become: yes @@ -73,7 +68,7 @@ become: yes register: make make: - chdir: "{{ ansible_user_dir }}/src/dwm" + chdir: "{{ desktop_src_dir }}/dwm" target: install - name: debug diff --git a/roles/dwm/tasks/dwmstatus.yml b/roles/dwm/tasks/dwmstatus.yml index 3658b09..df966b6 100644 --- a/roles/dwm/tasks/dwmstatus.yml +++ b/roles/dwm/tasks/dwmstatus.yml @@ -7,27 +7,22 @@ - git - make -- name: create src dir - file: - path: ~/src - state: directory - - name: checkout dwmstatus git: repo: "{{ dwmstatus.repo }}" - dest: "{{ ansible_user_dir }}/src/dwmstatus" + dest: "{{ desktop_src_dir }}/dwmstatus" clone: yes update: yes - name: build dwmstatus make: - chdir: "{{ ansible_user_dir }}/src/dwmstatus" + chdir: "{{ desktop_src_dir }}/dwmstatus" - name: install dwmstatus become: yes register: make make: - chdir: "{{ ansible_user_dir }}/src/dwmstatus" + chdir: "{{ desktop_src_dir }}/dwmstatus" target: install - name: debug diff --git a/roles/dwm/tasks/polybar.yml b/roles/dwm/tasks/polybar.yml index 0628b8a..4e5e547 100644 --- a/roles/dwm/tasks/polybar.yml +++ b/roles/dwm/tasks/polybar.yml @@ -24,35 +24,35 @@ - name: "polybar: create src dir" file: - path: "{{ ansible_user_dir }}/src" + path: "{{ desktop_src_dir }}" - name: "polybar: checkout" git: repo: "{{ polybar.repo }}" - dest: "{{ ansible_user_dir }}/src/polybar" + dest: "{{ desktop_src_dir }}/polybar" clone: yes update: yes - name: "polybar: create directory for build" file: state: directory - path: "{{ ansible_user_dir }}/src/polybar/build" + path: "{{ desktop_src_dir }}/polybar/build" - name: "polybar: run cmake" shell: cmd: "cmake ../" - chdir: "{{ ansible_user_dir }}/src/polybar/build" + chdir: "{{ desktop_src_dir }}/polybar/build" - name: "polybar: build" make: - chdir: "{{ ansible_user_dir }}/src/polybar/build" + chdir: "{{ desktop_src_dir }}/polybar/build" params: NUM_THREADS: "{{ ansible_processor_vcpus }}" - name: "polybar: install" become: yes make: - chdir: "{{ ansible_user_dir }}/src/polybar/build" + chdir: "{{ desktop_src_dir }}/polybar/build" target: install - name: "polybar: copy run script" diff --git a/roles/dwm/tasks/st-term.yml b/roles/dwm/tasks/st-term.yml index 54a131e..b3444c1 100644 --- a/roles/dwm/tasks/st-term.yml +++ b/roles/dwm/tasks/st-term.yml @@ -10,27 +10,22 @@ - fonts-symbola - libharfbuzz-dev -- name: create src dir - file: - path: ~/src - state: directory - - name: checkout st git: repo: "{{ st.repo }}" - dest: "{{ ansible_user_dir }}/src/stterm" + dest: "{{ desktop_src_dir }}/stterm" clone: yes update: yes - name: build st make: - chdir: "{{ ansible_user_dir }}/src/stterm" + chdir: "{{ desktop_src_dir }}/stterm" - name: install st become: yes register: make make: - chdir: "{{ ansible_user_dir }}/src/stterm" + chdir: "{{ desktop_src_dir }}/stterm" target: install - name: debug diff --git a/roles/ego/tasks/main.yml b/roles/ego/tasks/main.yml index ae12df5..bec0617 100644 --- a/roles/ego/tasks/main.yml +++ b/roles/ego/tasks/main.yml @@ -19,19 +19,19 @@ - name: checkout ego git: repo: "{{ ego.repo }}" - dest: "{{ ansible_user_dir }}/src/ego" + dest: "{{ desktop_src_dir }}/ego" clone: yes update: yes - name: build ego command: cargo install ego args: - chdir: "{{ ansible_user_dir }}/src/ego" + chdir: "{{ desktop_src_dir }}/ego" - name: copy ego become: yes copy: remote_src: true - src: "{{ ansible_user_dir }}/.cargo/bin/ego" + src: "{{ desktop_src_dir }}/.cargo/bin/ego" dest: /usr/local/bin/ego mode: '0755' diff --git a/roles/laptop/tasks/asusctl.yml b/roles/laptop/tasks/asusctl.yml index 3a8216c..e4d04e0 100644 --- a/roles/laptop/tasks/asusctl.yml +++ b/roles/laptop/tasks/asusctl.yml @@ -17,18 +17,18 @@ - name: checkout asusctl repo git: repo: "{{ asusctl.repo }}" - dest: "{{ ansible_user_dir }}/src/asusctl" + dest: "{{ desktop_src_dir }}/asusctl" clone: yes update: yes - name: build asusctl make: - chdir: "{{ ansible_user_dir }}/src/asusctl" + chdir: "{{ desktop_src_dir }}/asusctl" - name: install asusctl become: yes make: - chdir: "{{ ansible_user_dir }}/src/asusctl" + chdir: "{{ desktop_src_dir }}/asusctl" target: install - name: "Enable service" diff --git a/roles/laptop/tasks/supergfxctl.yml b/roles/laptop/tasks/supergfxctl.yml index 1bb8182..f4f585d 100644 --- a/roles/laptop/tasks/supergfxctl.yml +++ b/roles/laptop/tasks/supergfxctl.yml @@ -11,16 +11,16 @@ - name: checkout supergfxctl repo git: repo: "{{ supergfxctl.repo }}" - dest: "{{ ansible_user_dir }}/src/supergfxctl" + dest: "{{ desktop_src_dir }}/supergfxctl" clone: yes update: yes - name: build supergfxctl make: - chdir: "{{ ansible_user_dir }}/src/supergfxctl" + chdir: "{{ desktop_src_dir }}/supergfxctl" - name: install supergfxctl become: yes make: - chdir: "{{ ansible_user_dir }}/src/supergfxctl" + chdir: "{{ desktop_src_dir }}/supergfxctl" target: install diff --git a/roles/ubuntu/tasks/main.yml b/roles/ubuntu/tasks/main.yml index 20e7b1b..ff166ff 100644 --- a/roles/ubuntu/tasks/main.yml +++ b/roles/ubuntu/tasks/main.yml @@ -1,10 +1,12 @@ --- -- import_tasks: cleanup.yml +- import_tasks: rearrange-folders.yml -- import_tasks: timezone.yml - -- import_tasks: packages.yml - -- import_tasks: set-type.yml - -- import_tasks: dconf.yml \ No newline at end of file +#- import_tasks: cleanup.yml +# +#- import_tasks: timezone.yml +# +#- import_tasks: packages.yml +# +#- import_tasks: set-type.yml +# +#- import_tasks: dconf.yml \ No newline at end of file diff --git a/roles/ubuntu/tasks/rearrange-folders-loop.yml b/roles/ubuntu/tasks/rearrange-folders-loop.yml new file mode 100644 index 0000000..e4da864 --- /dev/null +++ b/roles/ubuntu/tasks/rearrange-folders-loop.yml @@ -0,0 +1,8 @@ +- name: "Lookup for {{ item }} directory" + stat: + path: "{{ desktop.old_source_dir }}/{{ item }}" + register: old_directory +- name: "Move {{ desktop.old_source_dir }}/{{ item }} to {{ desktop.apps_source_dir }}/{{ item }}" + command: mv {{ desktop.old_source_dir }}/{{ item }} {{ desktop.apps_source_dir }}/{{ item }} + when: + - old_directory.stat.exists diff --git a/roles/ubuntu/tasks/rearrange-folders.yml b/roles/ubuntu/tasks/rearrange-folders.yml new file mode 100644 index 0000000..a193d5d --- /dev/null +++ b/roles/ubuntu/tasks/rearrange-folders.yml @@ -0,0 +1,17 @@ +- name: create directory + file: + state: directory + path: "{{ desktop.apps_source_dir }}" + +- include_tasks: rearrange-folders-loop.yml + loop: + - asusctl + - dotfiles + - dwm + - dwm-nest + - ego + - dwmstatus + - polybar + - streamdeck + - stterm + - supergfxctl diff --git a/roles/ubuntu/vars/main.yml b/roles/ubuntu/vars/main.yml index 1cf7e81..1bdcbf9 100644 --- a/roles/ubuntu/vars/main.yml +++ b/roles/ubuntu/vars/main.yml @@ -1,2 +1,5 @@ --- timezone: Europe/Warsaw +desktop: + apps_source_dir: "{{ ansible_user_dir }}/src/desktop" + old_source_dir: "{{ ansible_user_dir }}/src" diff --git a/roles/virtual/tasks/looking-glass.yml b/roles/virtual/tasks/looking-glass.yml index 754bb06..9b6353b 100644 --- a/roles/virtual/tasks/looking-glass.yml +++ b/roles/virtual/tasks/looking-glass.yml @@ -29,15 +29,10 @@ - libpulse-dev - libsamplerate0-dev - -- name: create src dir - file: - path: "{{ ansible_user_dir }}/src" - - name: checkout looking glass git: repo: "{{ looking_glass.repo }}" - dest: "{{ ansible_user_dir }}/src/looking-glass" + dest: "{{ desktop_src_dir }}/looking-glass" version: "{{ looking_glass.branch }}" clone: yes update: yes @@ -45,21 +40,21 @@ - name: create directory for build file: state: directory - path: "{{ ansible_user_dir }}/src/looking-glass/client/build" + path: "{{ desktop_src_dir }}/looking-glass/client/build" - name: run cmake shell: cmd: "cmake ../" - chdir: "{{ ansible_user_dir }}/src/looking-glass/client/build" + chdir: "{{ desktop_src_dir }}/looking-glass/client/build" - name: build make: - chdir: "{{ ansible_user_dir }}/src/looking-glass/client/build" + chdir: "{{ desktop_src_dir }}/looking-glass/client/build" - name: copy become: yes copy: - src: "{{ ansible_user_dir }}/src/looking-glass/client/build/looking-glass-client" + src: "{{ desktop_src_dir }}/looking-glass/client/build/looking-glass-client" remote_src: yes dest: "/usr/local/bin/looking-glass-client" mode: "0755"