Refactor grpcbalancer setup in playbook.yml and remove legacy files. Replaced shell commands with Ansible copy module for grpcbalancer service file creation and enabled the service using systemd. Deleted grpc-balancer.py and grpc-balancer.service files as part of the cleanup process, streamlining the deployment configuration.

This commit is contained in:
vvzvlad 2025-01-20 18:57:00 +03:00
parent 22ce6c07c3
commit b988582553
3 changed files with 35 additions and 21 deletions

View File

@ -1,15 +0,0 @@
[Unit]
Description=GRPC Balancer Service
After=network.target
[Service]
Type=simple
User=root
Group=root
Environment=PYTHONUNBUFFERED=1
ExecStart=/usr/bin/python3 /usr/local/bin/grpc-balancer.py
Restart=always
RestartSec=2
[Install]
WantedBy=multi-user.target

View File

@ -203,12 +203,41 @@
- waitress
extra_args: --break-system-packages
- name: Copy grpcbalancer files
ansible.builtin.shell: |
cp {{ ansible_env.HOME }}/node/grpcbalancer/grpc-balancer.py /usr/local/bin/
chmod 755 /usr/local/bin/grpc-balancer.py
args:
executable: /bin/bash
- name: Copy grpcbalancer service file
ansible.builtin.copy:
dest: /etc/systemd/system/grpcbalancer.service
content: |
[Unit]
Description=GRPC Balancer Service
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory={{ ansible_env.HOME }}/node
ExecStart=/usr/bin/python3 {{ ansible_env.HOME }}/node/grpc-balancer.py
Restart=always
RestartSec=2
[Install]
WantedBy=multi-user.target
mode: '0644'
- name: Enable and start node-checker service
ansible.builtin.systemd:
name: grpcbalancer
enabled: yes
state: started
daemon_reload: yes
#- name: Copy grpcbalancer files
# ansible.builtin.shell: |
# cp {{ ansible_env.HOME }}/node/grpcbalancer/grpc-balancer.py /usr/local/bin/
# chmod 755 /usr/local/bin/grpc-balancer.py
# args:
# executable: /bin/bash
#- name: Install grpcbalancer service
# ansible.builtin.shell: |