Skip to content

Commit

Permalink
[ansible/format] Improve formating
Browse files Browse the repository at this point in the history
  • Loading branch information
goldyfruit committed Jan 21, 2024
1 parent d830c4e commit 0ff9ec1
Show file tree
Hide file tree
Showing 12 changed files with 318 additions and 95 deletions.
5 changes: 3 additions & 2 deletions ansible/roles/ovos_installer/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
- name: Start Sound Server
ansible.builtin.include_tasks: block-sound.yml
when: not (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and ansible_distribution_version is version('12.0', '<='))
when:
not (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and ansible_distribution_version is version('12.0', '<='))

- name: Reload Systemd User
become: true
Expand Down
5 changes: 3 additions & 2 deletions ansible/roles/ovos_installer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
- name: Include tuning/main.yml
ansible.builtin.import_tasks: tuning/main.yml
when: (ovos_installer_raspberrypi != "N/A" and ovos_installer_tuning | bool) or
(ovos_installer_raspberrypi != "N/A" and ovos_installer_cleaning | bool)
when:
(ovos_installer_raspberrypi != "N/A" and ovos_installer_tuning | bool) or
(ovos_installer_raspberrypi != "N/A" and ovos_installer_cleaning | bool)

- name: Include sound.yml
ansible.builtin.import_tasks: sound.yml
Expand Down
62 changes: 46 additions & 16 deletions ansible/roles/ovos_installer/tasks/ovos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,39 @@
path: "{{ item.directory }}"
owner: "{{ ovos_installer_user }}"
group: "{{ ovos_installer_user }}"
mode: '0755'
mode: "0755"
state: directory
loop:
- {"directory": "{{ ovos_installer_user_home }}/.config/systemd/user", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/ovos", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/ovos/config", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/ovos/config/phal", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/ovos/share", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/ovos/tmp", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/hivemind", "status": "{{ 'false' if ovos_installer_profile == 'ovos' else 'true' }}"}
- {"directory": "{{ ovos_installer_user_home }}/hivemind/config", "status": "{{ 'false' if ovos_installer_profile == 'ovos' else 'true' }}"}
- {"directory": "{{ ovos_installer_user_home }}/hivemind/share", "status": "{{ 'false' if ovos_installer_profile == 'ovos' else 'true' }}"}
- {
"directory": "{{ ovos_installer_user_home }}/.config/systemd/user",
"status": true,
}
- { "directory": "{{ ovos_installer_user_home }}/ovos", "status": true }
- {
"directory": "{{ ovos_installer_user_home }}/ovos/config",
"status": true,
}
- {
"directory": "{{ ovos_installer_user_home }}/ovos/config/phal",
"status": true,
}
- {
"directory": "{{ ovos_installer_user_home }}/ovos/share",
"status": true,
}
- { "directory": "{{ ovos_installer_user_home }}/ovos/tmp", "status": true }
- {
"directory": "{{ ovos_installer_user_home }}/hivemind",
"status": "{{ 'false' if ovos_installer_profile == 'ovos' else 'true' }}",
}
- {
"directory": "{{ ovos_installer_user_home }}/hivemind/config",
"status": "{{ 'false' if ovos_installer_profile == 'ovos' else 'true' }}",
}
- {
"directory": "{{ ovos_installer_user_home }}/hivemind/share",
"status": "{{ 'false' if ovos_installer_profile == 'ovos' else 'true' }}",
}
when:
- item.status | bool
- ovos_installer_method == "containers"
Expand All @@ -25,13 +46,22 @@
path: "{{ item.directory }}"
owner: "{{ ovos_installer_user }}"
group: "{{ ovos_installer_user }}"
mode: '0755'
mode: "0755"
state: directory
loop:
- {"directory": "{{ ovos_installer_user_home }}/.config/mycroft", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/.config/systemd/user", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/stdout", "status": true}
- {"directory": "{{ ovos_installer_user_home }}/nltk_data", "status": true}
- {
"directory": "{{ ovos_installer_user_home }}/.config/mycroft",
"status": true,
}
- {
"directory": "{{ ovos_installer_user_home }}/.config/systemd/user",
"status": true,
}
- { "directory": "{{ ovos_installer_user_home }}/stdout", "status": true }
- {
"directory": "{{ ovos_installer_user_home }}/nltk_data",
"status": true,
}
when:
- item.status | bool
- ovos_installer_method == "virtualenv"
Expand All @@ -44,6 +74,6 @@
dest: "{{ ovos_installer_user_home }}/{{ _configuration_path }}/mycroft.conf"
owner: "{{ ovos_installer_user }}"
group: "{{ ovos_installer_user }}"
mode: '0600'
mode: "0600"
backup: true
register: _configuration
15 changes: 9 additions & 6 deletions ansible/roles/ovos_installer/tasks/sound.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
- pipewire
- pipewire-alsa
- alsa-utils
when: not (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))
when:
not (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))

- name: Install PulseAudio on older Debian and Ubuntu versions
vars:
Expand All @@ -19,8 +20,9 @@
name:
- pulseaudio
- alsa-utils
when: (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))
when:
(ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))

- name: Add {{ ovos_installer_user }} to audio group
ansible.builtin.user:
Expand All @@ -38,8 +40,9 @@
- pipewire
- rtkit
append: true
when: not (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))
when:
not (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))

- name: Enable lingering for {{ ovos_installer_user }}
ansible.builtin.file:
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/ovos_installer/tasks/tuning/governor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
- name: Set existing CPU governor to "performance"
ansible.builtin.lineinfile:
path: "{{ _ovos_installer_cpu_governor_config }}"
regexp: '^CPU_DEFAULT_GOVERNOR='
regexp: "^CPU_DEFAULT_GOVERNOR="
line: 'CPU_DEFAULT_GOVERNOR="performance"'
when: _cpu_governor_config.stat.exists

Expand Down
5 changes: 3 additions & 2 deletions ansible/roles/ovos_installer/tasks/tuning/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
# Debian Unstable hack
_distribution_version: "{{ '99' if ansible_distribution == 'Debian' and ansible_distribution_version == 'n/a' else ansible_distribution_version }}"
ansible.builtin.import_tasks: tuning/zram.yml
when: not (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))
when:
not (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))

- name: Include tuning/sysctl.yml
ansible.builtin.import_tasks: tuning/sysctl.yml
Expand Down
28 changes: 14 additions & 14 deletions ansible/roles/ovos_installer/tasks/tuning/sysctl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
reload: true
state: "{{ ovos_installer_uninstall }}"
loop:
- {"option": "net.ipv4.tcp_slow_start_after_idle", "value": 0}
- {"option": "net.ipv4.tcp_tw_reuse", "value": 1}
- {"option": "net.core.netdev_max_backlog", "value": 50000}
- {"option": "net.ipv4.tcp_max_syn_backlog", "value": 30000}
- {"option": "net.ipv4.tcp_max_tw_buckets", "value": 2000000}
- {"option": "net.core.rmem_max", "value": 16777216}
- {"option": "net.core.wmem_max", "value": 16777216}
- {"option": "net.core.rmem_default", "value": 16777216}
- {"option": "net.core.wmem_default", "value": 16777216}
- {"option": "net.ipv4.tcp_rmem", "value": "4096 87380 16777216"}
- {"option": "net.ipv4.tcp_wmem", "value": "4096 65536 16777216"}
- {"option": "net.core.optmem_max", "value": 40960}
- {"option": "fs.inotify.max_user_instances", "value": 8192}
- {"option": "fs.inotify.max_user_watches", "value": 524288}
- { "option": "net.ipv4.tcp_slow_start_after_idle", "value": 0 }
- { "option": "net.ipv4.tcp_tw_reuse", "value": 1 }
- { "option": "net.core.netdev_max_backlog", "value": 50000 }
- { "option": "net.ipv4.tcp_max_syn_backlog", "value": 30000 }
- { "option": "net.ipv4.tcp_max_tw_buckets", "value": 2000000 }
- { "option": "net.core.rmem_max", "value": 16777216 }
- { "option": "net.core.wmem_max", "value": 16777216 }
- { "option": "net.core.rmem_default", "value": 16777216 }
- { "option": "net.core.wmem_default", "value": 16777216 }
- { "option": "net.ipv4.tcp_rmem", "value": "4096 87380 16777216" }
- { "option": "net.ipv4.tcp_wmem", "value": "4096 65536 16777216" }
- { "option": "net.core.optmem_max", "value": 40960 }
- { "option": "fs.inotify.max_user_instances", "value": 8192 }
- { "option": "fs.inotify.max_user_watches", "value": 524288 }
tags:
- always

Expand Down
10 changes: 5 additions & 5 deletions ansible/roles/ovos_installer/tasks/tuning/zram.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
reload: true
state: "{{ ovos_installer_uninstall }}"
loop:
- {"option": "vm.swappiness", "value": 100}
- {"option": "vm.page-cluster", "value": 0}
- {"option": "vm.vfs_cache_pressure", "value": 500}
- {"option": "vm.dirty_background_ratio", "value": 1}
- {"option": "vm.dirty_ratio", "value": 50}
- { "option": "vm.swappiness", "value": 100 }
- { "option": "vm.page-cluster", "value": 0 }
- { "option": "vm.vfs_cache_pressure", "value": 500 }
- { "option": "vm.dirty_background_ratio", "value": 1 }
- { "option": "vm.dirty_ratio", "value": 50 }
tags:
- always

Expand Down
18 changes: 15 additions & 3 deletions ansible/roles/ovos_installer/tasks/virtualenv/gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,21 @@
dest: "{{ item.dest }}"
version: "{{ item.branch }}"
loop:
- {"url": "https://github.com/OpenVoiceOS/mycroft-gui-qt5.git", "dest": "/opt/mycroft-gui", "branch": "dev"}
- {"url": "https://github.com/OpenVoiceOS/ovos-shell.git", "dest": "/opt/ovos-shell", "branch": "master"}
- {"url": "https://github.com/kbroulik/lottie-qml.git", "dest": "/opt/lottie", "branch": "master"}
- {
"url": "https://github.com/OpenVoiceOS/mycroft-gui-qt5.git",
"dest": "/opt/mycroft-gui",
"branch": "dev",
}
- {
"url": "https://github.com/OpenVoiceOS/ovos-shell.git",
"dest": "/opt/ovos-shell",
"branch": "master",
}
- {
"url": "https://github.com/kbroulik/lottie-qml.git",
"dest": "/opt/lottie",
"branch": "master",
}

- name: Create GUI directories
ansible.builtin.file:
Expand Down
Loading

0 comments on commit 0ff9ec1

Please sign in to comment.