summaryrefslogtreecommitdiff
path: root/roles/contexts/fretlink/tasks/main.yml
blob: 085da83a30899cfc11ebeb8ad9455883e03e1f6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
- name: Import roles
  include_role:
    name: "{{ item }}"
  loop:
    - programming/python
    - programming/haskell
    - programming/nodejs
- 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: 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
        src: "workdir/{{ item }}"
        dest: "$HOME/workdir/{{ item }}"
      loop:
        - 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:
            dest: $HOME/workdir/environment
            content: "{{ fretlink_environment.stdout }}"
- name: enable remind service
  systemd:
    state: started
    scope: user
    name: remind@work.service
    enabled: true