Skip to content

Commit

Permalink
[ansible] YAML linting based on 300 chars per line
Browse files Browse the repository at this point in the history
  • Loading branch information
goldyfruit committed Jul 12, 2024
1 parent 3bc7e22 commit 770d161
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 438 deletions.
14 changes: 2 additions & 12 deletions ansible/roles/ovos_installer/tasks/docker/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,8 @@
version: "{{ item.branch }}"
force: true
loop:
- {
"url": "{{ ovos_installer_ovos_docker_repo_url }}",
"branch": "{{ ovos_installer_ovos_docker_repo_branch }}",
"dest": "ovos-docker",
"state": "{{ true if (ovos_installer_profile != 'satellite' or ovos_installer_cleaning | bool) else false }}",
}
- {
"url": "{{ ovos_installer_hivemind_docker_repo_url }}",
"branch": "{{ ovos_installer_hivemind_docker_repo_branch }}",
"dest": "hivemind-docker",
"state": "{{ true if (ovos_installer_profile == 'satellite' or ovos_installer_cleaning | bool) else false }}",
}
- { "url": "{{ ovos_installer_ovos_docker_repo_url }}", "branch": "{{ ovos_installer_ovos_docker_repo_branch }}", "dest": "ovos-docker", "state": "{{ true if (ovos_installer_profile != 'satellite' or ovos_installer_cleaning | bool) else false }}" }
- { "url": "{{ ovos_installer_hivemind_docker_repo_url }}", "branch": "{{ ovos_installer_hivemind_docker_repo_branch }}", "dest": "hivemind-docker", "state": "{{ true if (ovos_installer_profile == 'satellite' or ovos_installer_cleaning | bool) else false }}" }
when: item.state | bool
tags:
- always
104 changes: 19 additions & 85 deletions ansible/roles/ovos_installer/tasks/docker/composer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,46 +36,16 @@
ansible.builtin.set_fact:
_composition_files: "{{ _composition_files | default([]) + [item.file] }}"
loop:
- {
"file": "docker-compose.yml",
"state": "{{ 'true' if (ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and _os_type == 'linux') else 'false' }}",
}
- {
"file": "docker-compose.windows.yml",
"state": "{{ 'true' if (ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and _os_type == 'wsl2') else 'false' }}",
}
- {
"file": "docker-compose.raspberrypi.yml",
"state": "{{ 'true' if (ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and ovos_installer_raspberrypi != 'N/A') else 'false' }}",
}
- {
"file": "docker-compose.skills.yml",
"state": "{{ 'false' if (ansible_memtotal_mb < 2048 and ovos_installer_profile != 'satellite' or not ovos_installer_feature_skills | bool) else 'true' }}",
}
- {
"file": "docker-compose.skills-extra.yml",
"state": "{{ 'false' if (ansible_memtotal_mb < 2048 and ovos_installer_profile != 'satellite' or not ovos_installer_feature_extra_skills | bool) else 'true' }}",
}
- {
"file": "docker-compose.hivemind.yml",
"state": "{{ 'true' if ovos_installer_profile == 'listener' else 'false' }}",
}
- {
"file": "docker-compose.gui.yml",
"state": "{{ 'true' if (ansible_memtotal_mb >= 1740 and ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and ovos_installer_feature_gui | bool) else 'false' }}",
}
- {
"file": "docker-compose.raspberrypi.gui.yml",
"state": "{{ 'true' if (ansible_memtotal_mb >= 1740 and ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and 'Raspberry Pi 4' in ovos_installer_raspberrypi and ovos_installer_feature_gui | bool) else 'false' }}",
}
- {
"file": "docker-compose.satellite.yml",
"state": "{{ 'true' if ovos_installer_profile == 'satellite' else 'false' }}",
}
- {
"file": "docker-compose.server.yml",
"state": "{{ 'true' if ovos_installer_profile == 'server' else 'false' }}",
}
- { "file": "docker-compose.yml", "state": "{{ 'true' if (ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and _os_type == 'linux') else 'false' }}" }
- { "file": "docker-compose.windows.yml", "state": "{{ 'true' if (ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and _os_type == 'wsl2') else 'false' }}" }
- { "file": "docker-compose.raspberrypi.yml", "state": "{{ 'true' if (ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and ovos_installer_raspberrypi != 'N/A') else 'false' }}" }
- { "file": "docker-compose.skills.yml", "state": "{{ 'false' if (ansible_memtotal_mb < 2048 and ovos_installer_profile != 'satellite' or not ovos_installer_feature_skills | bool) else 'true' }}" }
- { "file": "docker-compose.skills-extra.yml", "state": "{{ 'false' if (ansible_memtotal_mb < 2048 and ovos_installer_profile != 'satellite' or not ovos_installer_feature_extra_skills | bool) else 'true' }}" }
- { "file": "docker-compose.hivemind.yml", "state": "{{ 'true' if ovos_installer_profile == 'listener' else 'false' }}" }
- { "file": "docker-compose.gui.yml", "state": "{{ 'true' if (ansible_memtotal_mb >= 1740 and ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and ovos_installer_feature_gui | bool) else 'false' }}" }
- { "file": "docker-compose.raspberrypi.gui.yml", "state": "{{ 'true' if (ansible_memtotal_mb >= 1740 and ovos_installer_profile != 'satellite' and ovos_installer_profile != 'server' and 'Raspberry Pi 4' in ovos_installer_raspberrypi and ovos_installer_feature_gui | bool) else 'false' }}" }
- { "file": "docker-compose.satellite.yml", "state": "{{ 'true' if ovos_installer_profile == 'satellite' else 'false' }}" }
- { "file": "docker-compose.server.yml", "state": "{{ 'true' if ovos_installer_profile == 'server' else 'false' }}" }
when: item.state | bool

- name: Deploy docker-compose stack
Expand Down Expand Up @@ -116,51 +86,15 @@
become_user: "{{ ovos_installer_user }}"
vars:
_composition_mapping:
- {
"src": "ovos-docker",
"name": "ovos",
"file": "docker-compose.yml",
}
- {
"src": "ovos-docker",
"name": "ovos",
"file": "docker-compose.raspberrypi.yml",
}
- {
"src": "ovos-docker",
"name": "ovos",
"file": "docker-compose.skills.yml",
}
- {
"src": "ovos-docker",
"name": "ovos",
"file": "docker-compose.skills-extra.yml",
}
- {
"src": "ovos-docker",
"name": "ovos",
"file": "docker-compose.hivemind.yml",
}
- {
"src": "ovos-docker",
"name": "ovos",
"file": "docker-compose.gui.yml",
}
- {
"src": "ovos-docker",
"name": "ovos",
"file": "docker-compose.raspberrypi.gui.yml",
}
- {
"src": "ovos-docker",
"name": "ovos",
"file": "docker-compose.windows.yml",
}
- {
"src": "hivemind-docker",
"name": "hivemind",
"file": "docker-compose.satellite.yml",
}
- { "src": "ovos-docker", "name": "ovos", "file": "docker-compose.yml" }
- { "src": "ovos-docker", "name": "ovos", "file": "docker-compose.raspberrypi.yml" }
- { "src": "ovos-docker", "name": "ovos", "file": "docker-compose.skills.yml" }
- { "src": "ovos-docker", "name": "ovos", "file": "docker-compose.skills-extra.yml" }
- { "src": "ovos-docker", "name": "ovos", "file": "docker-compose.hivemind.yml" }
- { "src": "ovos-docker", "name": "ovos", "file": "docker-compose.gui.yml" }
- { "src": "ovos-docker", "name": "ovos", "file": "docker-compose.raspberrypi.gui.yml" }
- { "src": "ovos-docker", "name": "ovos", "file": "docker-compose.windows.yml" }
- { "src": "hivemind-docker", "name": "hivemind", "file": "docker-compose.satellite.yml" }
community.docker.docker_compose_v2:
project_src: "{{ _composition_directory }}"
project_name: "{{ item.name }}"
Expand Down
50 changes: 10 additions & 40 deletions ansible/roles/ovos_installer/tasks/ovos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,15 @@
mode: "0755"
state: directory
loop:
- {
"directory": "{{ ovos_installer_user_home }}/.config/systemd/user",
"status": 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/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' and ovos_installer_profile == 'server') else 'true' }}",
}
- {
"directory": "{{ ovos_installer_user_home }}/hivemind/config",
"status": "{{ 'false' if (ovos_installer_profile == 'ovos' and ovos_installer_profile == 'server') else 'true' }}",
}
- {
"directory": "{{ ovos_installer_user_home }}/hivemind/share",
"status": "{{ 'false' if (ovos_installer_profile == 'ovos' and ovos_installer_profile == 'server') else 'true' }}",
}
- { "directory": "{{ ovos_installer_user_home }}/hivemind", "status": "{{ 'false' if (ovos_installer_profile == 'ovos' and ovos_installer_profile == 'server') else 'true' }}" }
- { "directory": "{{ ovos_installer_user_home }}/hivemind/config", "status": "{{ 'false' if (ovos_installer_profile == 'ovos' and ovos_installer_profile == 'server') else 'true' }}" }
- { "directory": "{{ ovos_installer_user_home }}/hivemind/share", "status": "{{ 'false' if (ovos_installer_profile == 'ovos' and ovos_installer_profile == 'server') else 'true' }}" }
when:
- item.status | bool
- ovos_installer_method == "containers"
Expand All @@ -77,18 +56,9 @@
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 }}/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 }}/nltk_data", "status": true }
when:
- item.status | bool
- ovos_installer_method == "virtualenv"
Expand Down
6 changes: 2 additions & 4 deletions ansible/roles/ovos_installer/tasks/sound.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
- "{{ 'pipewire-alsa' if ansible_distribution not in ['Linux Mint', 'Zorin OS'] else 'pipewire' }}"
- alsa-utils
register: _pipewire_install
when:
not (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
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
Expand All @@ -21,8 +20,7 @@
- pulseaudio
- alsa-utils
register: _pulseaudio_install
when:
(ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
when: (ansible_distribution == 'Ubuntu' and _distribution_version is version('23.04', '<=') or
ansible_distribution == 'Debian' and _distribution_version is version('12.0', '<='))

- name: Determine available groups
Expand Down
18 changes: 3 additions & 15 deletions ansible/roles/ovos_installer/tasks/virtualenv/gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,9 @@
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 770d161

Please sign in to comment.