small reworks in frontend and scripts, mostly finalized ansible deploy script -- still needs testing
This commit is contained in:
parent
f41dfc4f86
commit
e57f803a52
25 changed files with 440 additions and 90 deletions
6
ansible_deploy/barcoinv.yml
Normal file
6
ansible_deploy/barcoinv.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
all:
|
||||
hosts:
|
||||
mmctrl-p1:
|
||||
projectors:
|
||||
- projector-p1-center
|
||||
- projector-p1-side
|
30
ansible_deploy/conf.j2
Normal file
30
ansible_deploy/conf.j2
Normal file
|
@ -0,0 +1,30 @@
|
|||
Hostname: {{ ansible_facts['hostname'] }} running {{ansible_facts['distribution'] }} on address {{ addr }}
|
||||
Connected projectors: {{ barco_G62[0].ip }}
|
||||
|
||||
[global]
|
||||
room = {{ room }}
|
||||
mqttIp = {{ mqtt_ip }}
|
||||
mqttPort = {{ mqtt_port }}
|
||||
|
||||
{% if barco_G62 %}
|
||||
{%+ for projector in barco_G62 +%}
|
||||
[{{projector.model}}.{{projector.position}}]
|
||||
ip = {{projector.ip}}
|
||||
port = {{projector.port}}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{%+ if tse_box +%}
|
||||
serial_device = {{ tse_box.serial_device }}
|
||||
{% endif %}
|
||||
|
||||
{%+ if projector_motors +%} {# change to appropriate thingy for running them #}
|
||||
{% end if %}
|
||||
|
||||
{%+ if extron_audio +%}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{%+ if extron_video +%}
|
||||
|
||||
{% endif %}
|
4
ansible_deploy/inventory.ini
Normal file
4
ansible_deploy/inventory.ini
Normal file
|
@ -0,0 +1,4 @@
|
|||
[prHosts]
|
||||
192.168.122.245
|
||||
|
||||
|
23
ansible_deploy/inventory.yml
Normal file
23
ansible_deploy/inventory.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
P01:
|
||||
hosts:
|
||||
192.168.122.245:
|
||||
vars:
|
||||
room: P01
|
||||
mqtt_ip: localhost
|
||||
mqtt_port: 1883
|
||||
|
||||
barco_G62:
|
||||
- position: main
|
||||
model: barco_G62
|
||||
port: 3023
|
||||
ip: 192.168.192.13
|
||||
- position : side
|
||||
model: barco_G62
|
||||
port: 3023
|
||||
ip: 192.168.192.14
|
||||
|
||||
barco_old:
|
||||
main_ip: 1.1.1.1
|
||||
|
||||
P22:
|
||||
|
152
ansible_deploy/playbook.yaml
Normal file
152
ansible_deploy/playbook.yaml
Normal file
|
@ -0,0 +1,152 @@
|
|||
- name: test playbook
|
||||
hosts: P01
|
||||
|
||||
#vars_files:
|
||||
# - secret
|
||||
vars:
|
||||
addr: "192.168.122.245"
|
||||
os_environment:
|
||||
- key: VITE_MQTT_HOST
|
||||
value: polztest.local
|
||||
|
||||
tasks:
|
||||
- name: ping hosts
|
||||
ansible.builtin.ping:
|
||||
|
||||
- name: install pkgs
|
||||
become: true
|
||||
#become_user: root
|
||||
apt:
|
||||
name:
|
||||
- mosquitto
|
||||
- python3-poetry
|
||||
#- npm
|
||||
- nginx
|
||||
state: latest
|
||||
|
||||
#- name: set env
|
||||
|
||||
- name: ensures services dir exists
|
||||
file:
|
||||
path: "/home/kat/pyServices"
|
||||
state: directory
|
||||
|
||||
- name: ensures services dir exists
|
||||
file:
|
||||
path: "/home/kat/pyServices/fri-mm-maline"
|
||||
state: directory
|
||||
|
||||
- name: Copy poetry
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
#seuser: root
|
||||
src: "../{{ item }}"
|
||||
dest: "/home/kat/pyServices/fri-mm-maline/{{ item }}"
|
||||
owner: kat
|
||||
group: kat
|
||||
mode: '0644'
|
||||
backup: yes
|
||||
loop:
|
||||
- poetry.lock
|
||||
- pyproject.toml
|
||||
- README.md
|
||||
|
||||
- name: copy python scripts
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: "../{{ item }}"
|
||||
dest: "/home/kat/pyServices/fri-mm-maline"
|
||||
owner: kat
|
||||
group: kat
|
||||
mode: '0644'
|
||||
backup: yes
|
||||
loop:
|
||||
- barco_telnet/barco_G62_control.py
|
||||
- extron_audio_matrix/extron_audio_matrix_telnet_control.py
|
||||
- extron_audio_matrix/extron_audio_matrix_telnet_interpreter.py
|
||||
- projector_motors/projector_motors.py
|
||||
- tse_serial/tse_serial_controler.py
|
||||
- tse_serial/tse_serial_interpreter.py
|
||||
- config.toml #TODO GENERATE CONFIG
|
||||
|
||||
|
||||
- name: poetry installation from thing
|
||||
ansible.builtin.shell:
|
||||
cmd: "poetry install"
|
||||
chdir: "/home/kat/pyServices/fri-mm-maline"
|
||||
|
||||
- name: Copy barco config
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
#seuser: root
|
||||
src: "../{{ item }}"
|
||||
dest: /lib/systemd/system
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
#backup: yes
|
||||
loop:
|
||||
- barco@.service
|
||||
- extron_audio.service
|
||||
- mqtt_init.service
|
||||
- projector_motors.service
|
||||
- tse_box.service
|
||||
|
||||
|
||||
|
||||
- name: Copy mosqitconfig
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
#seuser: root
|
||||
src: ../mosquitto.conf
|
||||
dest: /etc/mosquitto/conf.d
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
backup: yes
|
||||
|
||||
# - name: set env
|
||||
# become: true
|
||||
# ansible.builtin.lineinfile:
|
||||
# dest: "/etc/environment"
|
||||
# state: present
|
||||
# regexp: "^{{ item.key }}="
|
||||
# line: "{{ item.key }}={{ item.value }}"
|
||||
# with_items: "{{ os_environment }}"
|
||||
|
||||
- name: copy frontend to webroot
|
||||
become: true
|
||||
|
||||
ansible.builtin.copy:
|
||||
src: /home/kat/Documents/polzp/fri_multimedia_rework/frontend/vju_display/dist
|
||||
#src: /home/kat/fri_multimedia_rework/frontend/vju_display/dist
|
||||
#remote_src: true
|
||||
dest: /srv/www
|
||||
#dest: /home/kat/testoa
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
backup: yes
|
||||
|
||||
- name: enable modules
|
||||
become: true
|
||||
ansible.builtin.systemd_service:
|
||||
#name: "{{[ 'barco@main.service', 'barco@side.service' ]}}"
|
||||
name: "{{ item }}"
|
||||
state: stopped
|
||||
enabled: false
|
||||
loop:
|
||||
- barco@main.service
|
||||
- barco@side.service
|
||||
- extron_audio.service
|
||||
- mqtt_init.service
|
||||
- projector_motors.service
|
||||
- tse_box.service
|
||||
|
||||
|
||||
- name: mosquitto service and reload
|
||||
become: true
|
||||
ansible.builtin.systemd_service:
|
||||
name: mosquitto.service
|
||||
state: started
|
||||
daemon_reload: true
|
15
ansible_deploy/service.j2
Normal file
15
ansible_deploy/service.j2
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description={{ script_file }}
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/poetry run /usr/bin/python3 {{ script_file }}
|
||||
Type=simple
|
||||
Restart=always
|
||||
User=kat
|
||||
Group=kat
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
DefaultInstance=main
|
37
ansible_deploy/testbook.yaml
Normal file
37
ansible_deploy/testbook.yaml
Normal file
|
@ -0,0 +1,37 @@
|
|||
- name: test playbook
|
||||
hosts: P01
|
||||
|
||||
#vars_files:
|
||||
# - secret
|
||||
vars:
|
||||
addr: "192.168.122.245"
|
||||
os_environment:
|
||||
- key: VITE_MQTT_HOST
|
||||
value: polztest.local
|
||||
|
||||
tasks:
|
||||
- name: test things
|
||||
when: barco_g62 is defined
|
||||
block:
|
||||
#- name: ping hosts
|
||||
# ansible.builtin.ping:
|
||||
|
||||
- name: template config.toml
|
||||
ansible.builtin.template:
|
||||
src: ./conf.j2
|
||||
dest: /home/kat/testo/conf.txt
|
||||
- name: template barco systemd service
|
||||
vars:
|
||||
script_file: "/home/kat/pyServices/fri-mm-maline/barco_G62_control.py %i"
|
||||
ansible.builtin.template:
|
||||
src: ./service.j2
|
||||
dest: /home/kat/testo/barc.serv
|
||||
- name: enable barcos
|
||||
ansible.builtin.ping:
|
||||
#itd itd itd
|
||||
- name: test second
|
||||
when: barco_old is defined
|
||||
block:
|
||||
- name: pingerino
|
||||
ansible.builtin.ping:
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue