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:
parent
22ce6c07c3
commit
b988582553
@ -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
|
|
41
playbook.yml
41
playbook.yml
@ -203,12 +203,41 @@
|
|||||||
- waitress
|
- waitress
|
||||||
extra_args: --break-system-packages
|
extra_args: --break-system-packages
|
||||||
|
|
||||||
- name: Copy grpcbalancer files
|
- name: Copy grpcbalancer service file
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.copy:
|
||||||
cp {{ ansible_env.HOME }}/node/grpcbalancer/grpc-balancer.py /usr/local/bin/
|
dest: /etc/systemd/system/grpcbalancer.service
|
||||||
chmod 755 /usr/local/bin/grpc-balancer.py
|
content: |
|
||||||
args:
|
[Unit]
|
||||||
executable: /bin/bash
|
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
|
#- name: Install grpcbalancer service
|
||||||
# ansible.builtin.shell: |
|
# ansible.builtin.shell: |
|
||||||
|
Loading…
Reference in New Issue
Block a user