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

@ -3,6 +3,11 @@
hosts: All_server hosts: All_server
become: yes # برای اجرای دستورات با دسترسی ریشه become: yes # برای اجرای دستورات با دسترسی ریشه
tasks: tasks:
- name: Update all packages
zypper:
name: '*'
state: latest
- name: Install Git - name: Install Git
zypper: zypper:
name: git name: git
@ -17,3 +22,9 @@
zypper: zypper:
name: libgthread-2_0-0 name: libgthread-2_0-0
state: present state: present
- name: Symlink /usr/local/bin/python to python3.11
become: yes
ansible.builtin.command:
cmd: ln -sfn /usr/bin/python3.11 /usr/local/bin/python
creates: /usr/local/bin/python

View File

@ -5,7 +5,10 @@
vars: vars:
git_username: tester git_username: tester
git_password: Datall@0000 git_password: Datall@0000
app_path: /opt/DataDiodeRServer
venv_path: "{{ app_path }}/.env"
tasks: tasks:
#section clone in git
- name: Remove existing DataDiodeRServer directory - name: Remove existing DataDiodeRServer directory
file: file:
path: /opt/DataDiodeRServer path: /opt/DataDiodeRServer
@ -22,7 +25,26 @@
owner: datall owner: datall
group: users group: users
state: directory 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 - name: Copy all scripts from scripts directory to /usr/sbin
copy: copy:
src: /opt/DataDiodeRServer/scripts/ src: /opt/DataDiodeRServer/scripts/
@ -32,7 +54,7 @@
mode: '0755' mode: '0755'
recurse: yes recurse: yes
#section copy systemd file enable and start
- name: Copy datadiode.service to /etc/systemd/system/ - name: Copy datadiode.service to /etc/systemd/system/
copy: copy:
src: /opt/DataDiodeRServer/service/datadiode.service src: /opt/DataDiodeRServer/service/datadiode.service

View File

@ -4,8 +4,11 @@
become: yes # برای اجرای دستورات با دسترسی ریشه become: yes # برای اجرای دستورات با دسترسی ریشه
vars: vars:
git_username: tester git_username: tester
git_password: Datall@0000 git_password: Datall@0000\
app_path: /opt/DataDiodeTServer
venv_path: "{{ app_path }}/.env"
tasks: tasks:
#section clone in git
- name: Remove existing DataDiodeTServer directory - name: Remove existing DataDiodeTServer directory
file: file:
path: /opt/DataDiodeTServer path: /opt/DataDiodeTServer
@ -22,7 +25,25 @@
owner: datall owner: datall
group: users group: users
state: directory 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 - name: Copy all scripts from scripts directory to /usr/sbin
copy: copy:
src: /opt/DataDiodeRServer/scripts/ src: /opt/DataDiodeRServer/scripts/
@ -32,7 +53,7 @@
mode: '0755' mode: '0755'
recurse: yes recurse: yes
#section copy systemd file enable and start
- name: Copy datadiode.service to /etc/systemd/system/ - name: Copy datadiode.service to /etc/systemd/system/
copy: copy:
src: /opt/DataDiodeTServer/service/datadiode.service src: /opt/DataDiodeTServer/service/datadiode.service