X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=roles%2Fcontexts%2Ffretlink%2Ftasks%2Fmain.yml;h=972da59f59dfc85d5a0110087f0b5b53abf65ddc;hb=9b1cf1fff98c80fa2c2b157f1a8716b79fb040c2;hp=57d332e4d8aeb0767723616c03ebf78ef269643b;hpb=eac82f289d503c5bcc0d1e04784d027745d371c6;p=perso%2FImmae%2FConfig%2FAnsible.git diff --git a/roles/contexts/fretlink/tasks/main.yml b/roles/contexts/fretlink/tasks/main.yml index 57d332e..972da59 100644 --- a/roles/contexts/fretlink/tasks/main.yml +++ b/roles/contexts/fretlink/tasks/main.yml @@ -1,23 +1,69 @@ --- - name: Import roles include_role: - name: "{{ item }}" + name: "{{ fretlink_import_item }}" loop: - programming/python - programming/haskell - programming/nodejs + loop_control: + loop_var: fretlink_import_item +- name: Config dirs + file: + state: directory + path: "$XDG_CONFIG_HOME/{{ item }}" + loop: + - autostart + - Zeal + - pm2 - name: Config files copy: src: "config_files/{{ item }}" dest: "$XDG_CONFIG_HOME/{{ item }}" loop: - - "autostart/zeal.desktop" -- name: Create pm2 config dir - file: - path: $XDG_CONFIG_HOME/pm2 - state: directory + - autostart/zeal.desktop + - autostart/wpa-cute.desktop +- name: zeal configuration + ini_file: + path: "$XDG_CONFIG_HOME/Zeal/Zeal.conf" + section: "{{ item.0 }}" + option: "{{ item.1 }}" + value: "{{ item.2 }}" + no_extra_spaces: true + loop: + - [ "General", "check_for_update", "true" ] + - [ "General", "hide_on_close", "true" ] + - [ "General", "minimize_to_systray", "true" ] + - [ "General", "show_systray_icon", "true" ] + - [ "General", "start_minimized", "true" ] + - [ "docsets", "path", "{{ lookup('env', 'XDG_DATA_HOME') }}/Zeal/Zeal/docsets" ] + - [ "search", "fuzzy_search_enabled", "false" ] + - [ "tabs", "open_new_tab_after_active", "false" ] +- name: Zeal docsets + block: + - name: Check missing Zeal docsets + register: zeal_missing_docsets + shell: "for i in {{ zeal_roles | join(' ') }}; do [ -d $XDG_DATA_HOME/Zeal/Zeal/docsets/$i.docset ] || echo $i; done" + changed_when: zeal_missing_docsets.stdout != "" + check_mode: no + - name: Ask for Zeal docsets + when: zeal_missing_docsets.stdout != "" + pause: + prompt: "install Zeal docsets ? [y/N]" + register: zeal_install_docsets + check_mode: no + - name: Zeal docsets + when: zeal_missing_docsets.stdout != "" and zeal_install_docsets.user_input.startswith("y") + shell: "dasht-docsets-install {{ item }}" + args: + creates: "$XDG_DATA_HOME/Zeal/Zeal/docsets/{{ item }}.docset" + loop: "{{ zeal_missing_docsets.stdout.split('\n') }}" - name: workdir block: + - name: Workdir + file: + state: directory + path: $HOME/workdir - name: workdir scripts copy: mode: 0755 @@ -27,18 +73,77 @@ - start - name: environment variables file block: - - name: extract environment - shell: "pass show Travail/Fretlink/Environment" - register: fretlink_environment - changed_when: false - check_mode: no - - name: store environment - copy: + - name: environment file + template: + src: environment.j2 dest: $HOME/workdir/environment - content: "{{ fretlink_environment.stdout }}" + rescue: + - debug: + msg: "Could not read password store, continuing" - name: enable remind service systemd: state: started scope: user name: remind@work.service enabled: true +- name: scripts + block: + - name: completion directory + file: + state: directory + path: $XDG_DATA_HOME/bash_completion + - name: scripts + copy: + mode: 0755 + src: "scripts/{{ item }}" + dest: "$HOME/.local/bin/{{ item }}" + loop: + - fl_tmux_dev + - fl_vpn + - fl_getDump + - fl_restoreDump + - name: completion scripts + copy: + src: "scripts/_{{ item }}" + dest: "$XDG_DATA_HOME/bash_completion/_{{ item }}" + loop: + - fl_tmux_dev +- name: docker images + block: + - name: check missing docker images + register: docker_missing_images + shell: '[ -n "$(docker image ls -q {{ item.0 }}:{{ item.1 }})" ] || echo "missing"' + loop: "{{ docker_images }}" + check_mode: no + changed_when: docker_missing_images.stdout != "" + - name: Ask for Docker images + when: docker_missing_images.changed + pause: + prompt: "install Fretlink Docker images ? [y/N]" + register: docker_install_images + check_mode: no + - name: install custom docker images + when: item.2 is not none and docker_missing_images.changed and docker_install_images.user_input.startswith("y") + docker_image: + path: "./roles/contexts/fretlink/files/docker/{{ item.2 }}" + tag: "{{ item.1 }}" + name: "{{ item.0 }}" + loop: "{{ docker_images }}" + - name: install repository docker images + when: item.2 is none and docker_missing_images.changed and docker_install_images.user_input.startswith("y") + docker_image: + tag: "{{ item.1 }}" + name: "{{ item.0 }}" + loop: "{{ docker_images }}" +- name: add backup_git_dirs + get_url: + url: "https://git.immae.eu/?p=perso/Immae/Projets/Scripts/Public.git;a=blob_plain;f=backup_git_dirs;hb=HEAD" + dest: $HOME/.local/bin/backup_git_dirs + mode: 0755 + checksum: sha256:6b93902373e1f9269adffb1d4a0353dd3382f4ce6cb75bad9f61a3c409b80c95 +- name: backup work directory + cron: + name: backup workdir + minute: 0 + hour: 1 + job: '$HOME/.local/bin/backup_git_dirs $HOME/workdir/*/'