add roles/toxcore

This commit is contained in:
2024-01-08 12:51:06 +00:00
parent c8610f9ded
commit 7e491f4b8c
51 changed files with 1665 additions and 770 deletions

View File

@@ -106,19 +106,6 @@
- name: include by-platform tasks
include_tasks: "{{ ansible_distribution }}.yml"
- name: grub.cfg from roles/ansible-gentoo_install/tasks/
shell: |
LINE="rd.skipfsck=1 ipv6.disable=1 console=tty1 lang=en keymap=us"
# LINE="$LINE pti=on doscsi iommu=pt amd_iommu=on debugfs=off efi=disable_early_pci_dma extra_latent_entropy init_on_free=1 kvm.nx_huge_pages=force l1tf=full,force mce=0 mds=full,nosmt nosmt=force page_alloc.shuffle=1 pti=on random.trust_cpu=off slab_nomerge slub_debug=FZ spec_store_bypass_disable=on spectre_v2=on tsx_async_abort=full,nosmt vsyscall=none "
LINE="$LINE intel_iommu=on vga=0x315 text"
grep /boot /etc/fstab || exit 1
df | grep /boot || mount /boot || exit 2
[ -d /boot/grub ] || exit 3
[ -f /boot/grub/grub.cfg ] || exit 4
[ -f /boot/grub/grub.cfg.dst ] || cp -p /boot/grub/grub.cfg /boot/grub/grub.cfg.dst
sed -e 's@ ro *$@ '"$LINE"' ro@' -i /boot/grub/grub.cfg
ignore_errors: true
- name: add standard_users to groups
user:
name: "{{ item.0 }}"
@@ -126,12 +113,15 @@
groups: "{{ item.1 }}"
when:
- item != ''
- "len(toxcore_system_users) > 0"
# some groups may not be there
ignore_errors: true
with_nested:
- "{{ base_system_users }}"
- "{{ toxcore_standard_users_groups_host if ansible_virtualization_role|replace('NA', 'host') == 'host' else [] }}"
- "{{ toxcore_standard_users_groups_guest if ansible_virtualization_role|replace('NA', 'host') != 'host' else [] }}"
-
- "{{ toxcore_system_users }}"
-
- "{{ toxcore_standard_users_groups_host if ansible_virtualization_role|replace('NA', 'host') == 'host' else [] }}"
- "{{ toxcore_standard_users_groups_guest if ansible_virtualization_role|replace('NA', 'host') != 'host' else [] }}"
- name: "make a directory for /data/Vms"
file:
@@ -156,6 +146,7 @@
when:
- toxcore_gpg_keys_system|length > 0
- BASE_ARE_CONNECTED|default('') != ''
- false # none yet
ignore_errors: true
- name: "toxcore gpg keys gentoo"
@@ -182,13 +173,12 @@
environment: "{{ shell_proxy_env }}"
shell: |
umask 0002
sudo -u "{{ BOX_USER_NAME }}" \
bash {{TOXCORE_USR_LOCAL}}/src/usr_local_toxcore.bash \
{{ 'check' if ansible_check_mode }}
exit 0
args:
chdir: "{{TOXCORE_USR_LOCAL}}/src"
become: yes
become_user: "{{ BOX_USER_NAME }}"
ignore_errors: true
check_mode: false
@@ -201,26 +191,32 @@
- LOOP_ITEM != '' and LOOP_ITEM != []
with_items:
- "vms"
- "{{ 'libvirt_whonix' if (BOX_WHONIX_PROXY_HOST != '' or 'libvirt' in BOX_HOSTVMS_FEATURES or 'whonix' in BOX_TOXCORE_FEATURES) else [] }}"
- "{{ 'libvirt' if (BOX_WHONIX_PROXY_HOST != '' or 'libvirt' in BOX_TOXCORE_FEATURES or 'whonix' in BOX_TOXCORE_FEATURES) else [] }}"
loop_control:
loop_var: LOOP_ITEM
- name: "include_tasks toxcore users on the command host"
include_tasks:
file: "{{ LOOP_USER_F[1] }}"
apply:
environment: "{{ proxy_env }}"
become_user: "{{ LOOP_USER_F[0] }}"
- name: install toxcore pips HOST
environment: "{{ portage_proxy_env }}"
shell: |
sudo -u "{{ BOX_USER_NAME }}" \
pip3.sh install {{' '.join(toxcore_pips3_inst_host if ansible_virtualization_role|replace('NA', 'host') == 'host' else toxcore_pips3_inst_guest)}}
ignore_errors: "{{ BASE_PKG_IGNORE_ERRORS }}"
when:
- "LOOP_USER_F[1] != ''"
- BASE_ARE_CONNECTED|default('') != ''
- "ansible_virtualization_role|replace('NA', 'host') == 'host'"
with_nested:
-
- "{{ toxcore_system_users }}"
-
- users.yml
loop_control:
loop_var: LOOP_USER_F
- "len(toxcore_pips3_inst) > 0"
- name: install toxcore pips GUEST
environment: "{{ portage_proxy_env }}"
shell: |
[ -z "{{' '.join(toxcore_pips3_inst_guest)}}" ] || \
sudo -u "{{ BOX_USER_NAME }}" \
pip3.sh install {{' '.join(toxcore_pips3_inst_guest)}}
ignore_errors: "{{ BASE_PKG_IGNORE_ERRORS }}"
when:
- BASE_ARE_CONNECTED|default('') != ''
- "ansible_virtualization_role|replace('NA', 'host') != 'host'"
- name: "include_tasks toxcore users as user"
include_tasks:
@@ -233,7 +229,6 @@
- "ansible_virtualization_role|replace('NA', 'host') == 'host'"
- false
with_nested:
- "{{ toxcore_system_users }}"
-
#no - users
- "{{ 'libvirt_users' if 'libvirt' in TOXCORE_FEATURES else '' }}"
@@ -250,8 +245,7 @@
when:
- "item != ''"
- ansible_connection|default('') not in PLAY_CHROOT_CONNECTIONS
- "toxcore_services_enabled|length > 0"
with_items: "{{ toxcore_services_enabled }}"
with_items: "{{ toxcore_services_enabled_host if ansible_virtualization_role|replace('NA', 'host') == 'host' else toxcore_services_enabled_guest }}"
ignore_errors: true
- name: start toxcore services
@@ -371,26 +365,26 @@
# yaml.reader.ReaderError: unacceptable character #x0001: special characters are not allowed
- block:
- name: ansible-keepassxc
ansible-keepassxc:
database: "{{ base_passwords_database }}"
entry: "HOSTVMS_LXD_TRUST_PASSWORD"
group: "/Ansible/hostvms"
entry: "TOXCORE_LXD_TRUST_PASSWORD"
group: "/Ansible/toxcore"
password: "{{ base_passwords_password }}"
no_log: False
register: hostvms_lxd_trust_password
register: toxcore_lxd_trust_password
- debug:
verbosity: 1
var: hostvms_lxd_trust_password
var: toxcore_lxd_trust_password
check_mode: false
rescue:
- debug:
verbosity: 1
msg: "hostvms vms.yml WARN undefined or missing base_passwords_database "
msg: "toxcore vms.yml WARN RESCUE undefined or missing base_passwords_database "
- set_fact:
base_passwords_password: "{{HOSTVMS_LXD_TRUST_PASSWORD}}"
base_passwords_password: "{{TOXCORE_LXD_TRUST_PASSWORD}}"
when: false