add comment, add run datadiode python

This commit is contained in:
ArdavanPb
2025-07-23 11:57:58 +03:30
parent 6342cc01ae
commit 6d5116104b
3 changed files with 58 additions and 4 deletions

View File

@@ -4,8 +4,11 @@
become: yes # برای اجرای دستورات با دسترسی ریشه
vars:
git_username: tester
git_password: Datall@0000
git_password: Datall@0000\
app_path: /opt/DataDiodeTServer
venv_path: "{{ app_path }}/.env"
tasks:
#section clone in git
- name: Remove existing DataDiodeTServer directory
file:
path: /opt/DataDiodeTServer
@@ -22,7 +25,25 @@
owner: datall
group: users
state: directory
#section active python and install requirements
- name: Create a Python 3 venv
ansible.builtin.command:
cmd: python3 -m venv "{{ venv_path }}"
args:
creates: "{{ venv_path }}/bin/activate"
- name: Upgrade pip & setuptools inside the venv
ansible.builtin.command:
cmd: "{{ venv_path }}/bin/python -m pip install --upgrade pip setuptools"
- name: Install requirements into the venv
ansible.builtin.pip:
requirements: "{{ app_path }}/requirements.txt"
virtualenv: "{{ venv_path }}"
virtualenv_command: python3 -m venv
virtualenv_site_packages: no
#section copy scripts to path
- name: Copy all scripts from scripts directory to /usr/sbin
copy:
src: /opt/DataDiodeRServer/scripts/
@@ -32,7 +53,7 @@
mode: '0755'
recurse: yes
#section copy systemd file enable and start
- name: Copy datadiode.service to /etc/systemd/system/
copy:
src: /opt/DataDiodeTServer/service/datadiode.service