Skip to content

Instantly share code, notes, and snippets.

@anujdevopslearn
Last active May 1, 2025 17:17
Show Gist options
  • Save anujdevopslearn/b27a865719f60cf02c2c5fe7a6513a11 to your computer and use it in GitHub Desktop.
Save anujdevopslearn/b27a865719f60cf02c2c5fe7a6513a11 to your computer and use it in GitHub Desktop.
---
- hosts: webservers
tasks:
- name: Install Python package
apt:
pkg:
- python3
- unzip
- python3-pip
- name: Copy Python code on Application servers
get_url: url="https://github.com/anujdevopslearn/PythonServer/archive/refs/heads/main.zip" dest=/tmp/artifact.zip
- name: Extract Code
unarchive: src=/tmp/artifact.zip dest=/opt/ remote_src=True
- name: Run Python Code
shell: |
pip3 install -r requirements.txt --break-system-packages
nohup python3 app.py &
args:
chdir: /opt/PythonServer-main
@anujdevopslearn
Copy link
Author

public

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment