diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c8d7879 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +#Don't track python cache files +patching/__pycache__/* +patching/migrations/__pycache__/* +scripts/patching/__pycache__/* +vsmooth/__pycache__/* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..39cb4b5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "frontail/frontail"] + path = frontail/frontail + url = https://github.com/mismailzz/frontail.git diff --git a/db.sqlite3 b/db.sqlite3 index 459a0ac..ff07f38 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/patching/__pycache__/__init__.cpython-36.pyc b/patching/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index dd6cbc2..0000000 Binary files a/patching/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/patching/__pycache__/__init__.cpython-39.pyc b/patching/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 35080c7..0000000 Binary files a/patching/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/patching/__pycache__/admin.cpython-36.pyc b/patching/__pycache__/admin.cpython-36.pyc deleted file mode 100644 index 6761141..0000000 Binary files a/patching/__pycache__/admin.cpython-36.pyc and /dev/null differ diff --git a/patching/__pycache__/admin.cpython-39.pyc b/patching/__pycache__/admin.cpython-39.pyc deleted file mode 100644 index 8541c0c..0000000 Binary files a/patching/__pycache__/admin.cpython-39.pyc and /dev/null differ diff --git a/patching/__pycache__/apps.cpython-36.pyc b/patching/__pycache__/apps.cpython-36.pyc deleted file mode 100644 index 4ae68d1..0000000 Binary files a/patching/__pycache__/apps.cpython-36.pyc and /dev/null differ diff --git a/patching/__pycache__/apps.cpython-39.pyc b/patching/__pycache__/apps.cpython-39.pyc deleted file mode 100644 index 9a44d9e..0000000 Binary files a/patching/__pycache__/apps.cpython-39.pyc and /dev/null differ diff --git a/patching/__pycache__/forms.cpython-36.pyc b/patching/__pycache__/forms.cpython-36.pyc deleted file mode 100644 index 9912d77..0000000 Binary files a/patching/__pycache__/forms.cpython-36.pyc and /dev/null differ diff --git a/patching/__pycache__/forms.cpython-39.pyc b/patching/__pycache__/forms.cpython-39.pyc deleted file mode 100644 index e9e7a5b..0000000 Binary files a/patching/__pycache__/forms.cpython-39.pyc and /dev/null differ diff --git a/patching/__pycache__/models.cpython-36.pyc b/patching/__pycache__/models.cpython-36.pyc deleted file mode 100644 index 616f7be..0000000 Binary files a/patching/__pycache__/models.cpython-36.pyc and /dev/null differ diff --git a/patching/__pycache__/models.cpython-39.pyc b/patching/__pycache__/models.cpython-39.pyc deleted file mode 100644 index 99bd97d..0000000 Binary files a/patching/__pycache__/models.cpython-39.pyc and /dev/null differ diff --git a/patching/__pycache__/urls.cpython-36.pyc b/patching/__pycache__/urls.cpython-36.pyc deleted file mode 100644 index 7a34323..0000000 Binary files a/patching/__pycache__/urls.cpython-36.pyc and /dev/null differ diff --git a/patching/__pycache__/urls.cpython-39.pyc b/patching/__pycache__/urls.cpython-39.pyc deleted file mode 100644 index 0695b4e..0000000 Binary files a/patching/__pycache__/urls.cpython-39.pyc and /dev/null differ diff --git a/patching/__pycache__/views.cpython-36.pyc b/patching/__pycache__/views.cpython-36.pyc deleted file mode 100644 index 9a29ecd..0000000 Binary files a/patching/__pycache__/views.cpython-36.pyc and /dev/null differ diff --git a/patching/__pycache__/views.cpython-39.pyc b/patching/__pycache__/views.cpython-39.pyc deleted file mode 100644 index 9690197..0000000 Binary files a/patching/__pycache__/views.cpython-39.pyc and /dev/null differ diff --git a/patching/forms.py b/patching/forms.py index 81ad809..db4a555 100644 --- a/patching/forms.py +++ b/patching/forms.py @@ -1,6 +1,6 @@ from django import forms from django.core import validators -from patching.models import HypervisorInfo +from patching.models import HypervisorInfo, VirtualMachineInfo class HypervisorInfo_Form(forms.ModelForm): @@ -11,6 +11,23 @@ class Meta: widgets = { 'esxi_hostname': forms.TextInput(attrs={'class': 'mycssclass'}), 'esxi_username': forms.TextInput(attrs={'class': 'mycssclass'}), - 'esxi_password': forms.TextInput(attrs={'class': 'mycssclass'}), - 'esxi_password': forms.PasswordInput(), + 'esxi_password': forms.PasswordInput(attrs={'class': 'mycssclass'}), + } + labels = { + 'esxi_hostname': ('ESXi Hostname'), + 'esxi_username': ('ESXi Username'), + 'esxi_password': ('ESXi Password'), + } + +class VirtualMachineInfo_Form(forms.ModelForm): + class Meta: + model = VirtualMachineInfo + fields = ('vm_username', 'vm_password',) + widgets = { + 'vm_username': forms.TextInput(attrs={'class': 'mycssclass'}), + 'vm_password': forms.PasswordInput(attrs={'class': 'mycssclass'}), + } + labels = { + 'vm_username': ('VM Username'), + 'vm_password': ('VM Password'), } diff --git a/patching/migrations/0004_auto_20211117_1758.py b/patching/migrations/0004_auto_20211117_1758.py new file mode 100644 index 0000000..ab76ab6 --- /dev/null +++ b/patching/migrations/0004_auto_20211117_1758.py @@ -0,0 +1,26 @@ +# Generated by Django 3.2.5 on 2021-11-17 17:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('patching', '0003_auto_20211114_0659'), + ] + + operations = [ + migrations.CreateModel( + name='VirtualMachineInfo', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('vm_username', models.CharField(max_length=100)), + ('vm_password', models.CharField(max_length=100)), + ], + ), + migrations.AlterField( + model_name='hypervisorinfo', + name='id', + field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), + ), + ] diff --git a/patching/migrations/__pycache__/0001_initial.cpython-36.pyc b/patching/migrations/__pycache__/0001_initial.cpython-36.pyc deleted file mode 100644 index db53737..0000000 Binary files a/patching/migrations/__pycache__/0001_initial.cpython-36.pyc and /dev/null differ diff --git a/patching/migrations/__pycache__/0001_initial.cpython-39.pyc b/patching/migrations/__pycache__/0001_initial.cpython-39.pyc deleted file mode 100644 index c75ec78..0000000 Binary files a/patching/migrations/__pycache__/0001_initial.cpython-39.pyc and /dev/null differ diff --git a/patching/migrations/__pycache__/0002_delete_selected_vms.cpython-36.pyc b/patching/migrations/__pycache__/0002_delete_selected_vms.cpython-36.pyc deleted file mode 100644 index 32ab5c0..0000000 Binary files a/patching/migrations/__pycache__/0002_delete_selected_vms.cpython-36.pyc and /dev/null differ diff --git a/patching/migrations/__pycache__/0002_delete_selected_vms.cpython-39.pyc b/patching/migrations/__pycache__/0002_delete_selected_vms.cpython-39.pyc deleted file mode 100644 index 3fc2b34..0000000 Binary files a/patching/migrations/__pycache__/0002_delete_selected_vms.cpython-39.pyc and /dev/null differ diff --git a/patching/migrations/__pycache__/0003_auto_20211114_0659.cpython-36.pyc b/patching/migrations/__pycache__/0003_auto_20211114_0659.cpython-36.pyc deleted file mode 100644 index 2590a7a..0000000 Binary files a/patching/migrations/__pycache__/0003_auto_20211114_0659.cpython-36.pyc and /dev/null differ diff --git a/patching/migrations/__pycache__/__init__.cpython-36.pyc b/patching/migrations/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 0787c6b..0000000 Binary files a/patching/migrations/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/patching/migrations/__pycache__/__init__.cpython-39.pyc b/patching/migrations/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 10039a1..0000000 Binary files a/patching/migrations/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/patching/models.py b/patching/models.py index 3afb8b4..12d40c2 100644 --- a/patching/models.py +++ b/patching/models.py @@ -5,3 +5,7 @@ class HypervisorInfo(models.Model): esxi_hostname = models.CharField(max_length=100) esxi_username = models.CharField(max_length=100) esxi_password = models.CharField(max_length=100) + +class VirtualMachineInfo(models.Model): + vm_username = models.CharField(max_length=100) + vm_password = models.CharField(max_length=100) diff --git a/patching/views.py b/patching/views.py index 13f7f2e..e209cd5 100644 --- a/patching/views.py +++ b/patching/views.py @@ -1,7 +1,8 @@ from django.shortcuts import render from . import forms -from patching.forms import HypervisorInfo_Form +from patching.forms import HypervisorInfo_Form, VirtualMachineInfo_Form import scripts.patching.vmfilter as ansible_vminfo +import scripts.patching.controller as ansible_controller import json import os @@ -12,9 +13,16 @@ def index(request): return render(request, 'patching/index.html') - def connect_select_patch(request): hypervisorForm = HypervisorInfo_Form() + virtualMachineForm = VirtualMachineInfo_Form() + + vhostname = "" + vusername = "" + vpassword = "" + vm_username = "" + vm_password = "" + ansible_playbookPath = "playbook/patching/" virtual_machine_dict = {} @@ -24,15 +32,14 @@ def connect_select_patch(request): if hypervisorForm.is_valid(): print("Validation") - print("IP: ", hypervisorForm.cleaned_data['esxi_hostname']) - print("User: ", hypervisorForm.cleaned_data['esxi_username']) - print("Password: ", hypervisorForm.cleaned_data['esxi_password']) + vhostname = hypervisorForm.cleaned_data['esxi_hostname'] + vusername = hypervisorForm.cleaned_data['esxi_username'] + vpassword = hypervisorForm.cleaned_data['esxi_password'] + vmware_hypervisor = ansible_controller.VMwareHypervisorVariables(vhostname, vusername, vpassword, ansible_playbookPath) + vmware_hypervisor.vmInfo() vm_resultjson() - vm_readJson() #form.save(commit=True) #return index(request) - #my_dict_vms = {'virtual_machines': vm_readJson()} - #return render(request, 'patching/patch_panel.html', context=my_dict_vms) virtual_machine_dict = vm_readJson() else: print('ERROR FORM INVALID') @@ -42,9 +49,27 @@ def connect_select_patch(request): if request.POST.get('vm_names'): selected_vms = request.POST.get('vm_names'); print("Virtual Machines Selected:", selected_vms) - - #return render(request,'patching/patch_panel.html',{'form1':hypervisorForm, 'form2': selectVMForm, 'virtual_machines': virtual_machine_dict}) - return render(request,'patching/patch_panel.html',{'form1':hypervisorForm, 'virtual_machines': virtual_machine_dict}) + vmware_hypervisor = ansible_controller.VMwareHypervisorVariables() + vmware_hypervisor.vmSelectedInfo(selected_vms, ansible_playbookPath) + + elif 'executevmbutton' in request.POST: + virtualMachineForm = VirtualMachineInfo_Form(request.POST) + vmware_hypervisor = ansible_controller.VMwareHypervisorVariables() + + if virtualMachineForm.is_valid(): + #GET THE CREDENTIONALS INFORMATION OF THE VIRTUAL MACHINES + vm_username = virtualMachineForm.cleaned_data['vm_username'] + vm_password = virtualMachineForm.cleaned_data['vm_password'] + vmware_hypervisor.vmCredentialsInfo(vm_username, vm_password, ansible_playbookPath) + #GET THE PATCH COMMANDS INFORMATION FROM THE TEXTAREA AND SAVE TO FILE + if request.POST.get('vmpatch'): + vm_patchCommands = request.POST.get('vmpatch') + print(vm_patchCommands) + vmware_hypervisor.vm_patchCommands(vm_patchCommands, ansible_playbookPath) + vmware_hypervisor.vmPatch() + + + return render(request,'patching/patch_panel.html',{'form1':hypervisorForm, 'virtual_machines': virtual_machine_dict, 'form2':virtualMachineForm,}) def vm_resultjson(): diff --git a/playbook/patching/variablefile b/playbook/patching/hypvariablefile similarity index 100% rename from playbook/patching/variablefile rename to playbook/patching/hypvariablefile diff --git a/playbook/patching/inventory.ini b/playbook/patching/inventory.ini new file mode 100644 index 0000000..e69de29 diff --git a/playbook/patching/vmInfo.yml b/playbook/patching/vmInfo.yml index 54b22c9..ac4080a 100644 --- a/playbook/patching/vmInfo.yml +++ b/playbook/patching/vmInfo.yml @@ -2,7 +2,7 @@ hosts: local gather_facts: no vars_files: - - variablefile + - hypvariablefile tasks: - name: Gather all registered virtual machines community.vmware.vmware_vm_info: @@ -18,20 +18,6 @@ - name: Delete Existing file file: state: absent - path: varDir/temp + path: ../../temp/patching/ansible_vmresult delegate_to: localhost - - local_action: copy content={{ vminfo }} dest=varDir/temp - - - name: Display results - debug: - var: vminfo - - - name: Run a script using an executable in a system path - ansible.builtin.script: ./scripts/filter.py - args: - executable: python3 - delegate_to: localhost - register: vmDict - - name: Resultant Dictionary - debug: - var: vmDict.stdout_lines + - local_action: copy content={{ vminfo }} dest=../../temp/patching/ansible_vmresult diff --git a/playbook/patching/vmpatch.yml b/playbook/patching/vmpatch.yml new file mode 100644 index 0000000..3437297 --- /dev/null +++ b/playbook/patching/vmpatch.yml @@ -0,0 +1,39 @@ +--- +- hosts: localhost + gather_facts: no + + vars_files: + - hypvariablefile + - vm_patchvariablefile + - vmvariablefile + - patchCommand.yml + + tasks: + - name: Gather all registered virtual machines + community.vmware.vmware_vm_info: + hostname: "{{ esxi_hostname }}" + username: "{{ esxi_username }}" + password: "{{ esxi_password }}" + vm_type: vm + validate_certs: no + delegate_to: localhost + register: vminfo + + - name: Execute the targeted commands - CLEAN/LIST REPO/UPDATE + community.vmware.vmware_vm_shell: + hostname: "{{ esxi_hostname }}" + username: "{{ esxi_username }}" + password: "{{ esxi_password }}" + validate_certs: no + vm_id: "{{ item[0].guest_name }}" + vm_username: "{{ guestvm_username }}" + vm_password: "{{ guestvm_password }}" + wait_for_process: True + vm_shell: "/bin/echo" + vm_shell_args: "$( {{ item[1] }} )" + when: (item[0].power_state == "poweredOn") and (item[0].guest_name in vm_toPatched) + with_nested: + - "{{ vminfo.virtual_machines }}" + - "{{ run_commands }}" + delegate_to: localhost + register: result diff --git a/scripts/patching/__pycache__/vmfilter.cpython-36.pyc b/scripts/patching/__pycache__/vmfilter.cpython-36.pyc deleted file mode 100644 index f326bc0..0000000 Binary files a/scripts/patching/__pycache__/vmfilter.cpython-36.pyc and /dev/null differ diff --git a/scripts/patching/__pycache__/vmfilter.cpython-39.pyc b/scripts/patching/__pycache__/vmfilter.cpython-39.pyc deleted file mode 100644 index 0937efa..0000000 Binary files a/scripts/patching/__pycache__/vmfilter.cpython-39.pyc and /dev/null differ diff --git a/scripts/patching/controller.py b/scripts/patching/controller.py index 307ec72..ba149a0 100644 --- a/scripts/patching/controller.py +++ b/scripts/patching/controller.py @@ -8,84 +8,132 @@ def scriptEndExecution(): os.system("rm -f vmInventory") def getVmInformation(): - os.system("ansible-playbook vmInfo.yml -e 'ansible_python_interpreter=/usr/bin/python3'") - -def seletectVM(): - readVmInfo = open("vmInventory", "r") - vmList=":" - checker = None - - for line in readVmInfo: - #print(line) - line = line.strip() ##Remove newline character - prompt= line + " [ Do you want to patch it (y/n) ] - " - user_vmSeletection = input(prompt) - if(user_vmSeletection == "y"): - vm_name = line.split(":") - vmList = vmList + ", " + vm_name[1] - checker = True - elif(user_vmSeletection == "n"): - print(line + "- Skipped") - else: - print("INVALID OPTION SELECTION") - exit() - - readVmInfo.close() - if (checker == True): - vmList = vmList.replace(':,','') - vmList = vmList.replace(' , ','", "') - vmList = "[\"" + vmList + "\" ]" - vmList = vmList.replace(" ","") - return vmList - else: - print("NO VM SELECTED") - exit() - -def vmPatch_variable(): - vmguest_username="" - vmguest_password="" - #vmguest_shellcommand="/usr/bin/echo" - vmguest_topatch=seletectVM() - - vmguest_username = input("Provide the username for VM: ") - vmguest_password = getpass.getpass(prompt='VMware Esxi Host Guest VM Password? ') - variablefile = open("variablefile","a") - - vmguest_username_string= " guestvm_username: \"" + vmguest_username + "\"\n" - vmguest_password_string= " guestvm_password: \"" + vmguest_password + "\"\n" - #vmguest_shellcommand_string= " vm_shellcommand_echo: \"" + vmguest_shellcommand + "\"\n" - vmguest_topatch_string= " vm_toPatched: " + vmguest_topatch + "\n" - - variablefile.write(vmguest_username_string) - variablefile.write(vmguest_password_string) - #variablefile.write(vmguest_shellcommand_string) - variablefile.write(vmguest_topatch_string) - variablefile.close() + os.system("ansible-playbook -i playbook/patching/inventory.ini playbook/patching/vmInfo.yml -e 'ansible_python_interpreter=/usr/bin/python3'") def startpatch(): - os.system("ansible-playbook vmpatch.yml -e 'ansible_python_interpreter=/usr/bin/python3'") + os.system("ansible-playbook -i playbook/patching/inventory.ini playbook/patching/vmpatch.yml -e 'ansible_python_interpreter=/usr/bin/python3'") ##-----------------------------MAIN FUNCTION---------------------------------- class VMwareHypervisorVariables: - def __init__(self, esxi_hostname, esxi_username, esxi_password, ansible_variablefile): - server_hostname = " esxi_hostname: \"" + esxi_hostname + "\"\n" - server_username = " esxi_username: \"" + esxi_username + "\"\n" - server_password = " esxi_password: \"" + esxi_password + "\"\n" + def __init__(self, esxi_hostname=None, esxi_username=None, esxi_password=None, ansible_playbookPath=None): + + """ + OURLOAD CONSTRUCTOR BY DEFAULT VALUES TO OPERATE FOR BOTH SCENERIOS WITH/WITOUT + ARGUMENTS. BECAUSE WE DON'T WANT TO REINITIALIZE OR CREATE THE VARIABLE FILE + FOR THE HYPERVISOR IN CASE OF VIRTUAL MACHINE + """ + if esxi_hostname and esxi_username and esxi_password and ansible_playbookPath: + """ + THIS IS THE CONSTRUCTOR THAT WILL MAKE/CONFIGURE THE FILES FOR THE HYPERVISOR + THAT ARE FUNDAMENTAL FOR BUILDING THE CONNECTION + """ + #ENTER SERVER INFORMATION IF VARIABLE FILE FOR ANSIBLE PLAYBOOK + server_hostname = " esxi_hostname: \"" + esxi_hostname + "\"\n" + server_username = " esxi_username: \"" + esxi_username + "\"\n" + server_password = " esxi_password: \"" + esxi_password + "\"\n" + + #To empty variable file + variableFilePath = ansible_playbookPath + "hypvariablefile" + temp_command = ">" + variableFilePath + os.system(temp_command) #empty file + + variablefile = open(variableFilePath,"a") + variablefile.write(server_hostname) + variablefile.write(server_username) + variablefile.write(server_password) + variablefile.close() + #--------------------------------------------------------------- + # READY THE ANSIBLE CONFIGURATION FILE + ansibe_cfgPath = ansible_playbookPath + "ansible.cfg" + temp_command = ">" + ansibe_cfgPath + os.system(temp_command) + ansible_cfg = open(ansibe_cfgPath,"a") + ansible_cfg.write("[defaults]\n") + ansible_cfg.write("host_key_checking = False \n") + ansible_cfg.write("inventory = inventory.ini \n") + ansible_cfg.close() + #--------------------------------------------------------------- + # READY THE ANSIBLE INVENTORY FILE + ansible_inventoryPath = ansible_playbookPath + "inventory.ini" + temp_command = ">" + ansible_inventoryPath + os.system(temp_command) + inventoryfile = open(ansible_inventoryPath,"a") + inventoryfile.write("[local]\n") + inventoryfile.write( esxi_hostname + "\n") + inventoryfile.close() + #--------------------------------------------------------------- + else: + print("Without parameters") + + def vmSelectedInfo(self, vm_toPatched, ansible_playbookPath): + print("VM select function") + #ENTER VM INFORMATION TO BE PATCHED IN SEPARATE VMS FILE + if vm_toPatched != "": + vmListvariable = '["'+ vm_toPatched.replace(',','","') + '"]' + vmguest_topatch_string= ' vm_toPatched: ' + vmListvariable + '\n' + + #To empty variable file + variableFilePath = ansible_playbookPath + "vm_patchvariablefile" + temp_command = ">" + variableFilePath + os.system(temp_command) #empty file + + variablefile = open(variableFilePath,"a") + variablefile.write(vmguest_topatch_string) + variablefile.close() + + else: + print("NO VM SELECTED") + + def vmCredentialsInfo(self, vm_username, vm_password, ansible_playbookPath): + """ + SIMILAR PATTERN WILL BE FOLLOWED AS ABOVE FOR APPENDING INFORMATION + FOR THE VM BUT IN THIS CASE WE WILL BUILD SEPARATE FILE FROM variable + OF THE HYPERVISOR BECAUSE WE HAVE TWO SEPARATE PORTION FORMS OF + HYPERVISOR AND VM, DUE TO WHICH IF THE USER ENTER THE VM CREDENTIONAL + INFO REPEATEDLY THEN THE APPEND MODE IN THE HYPERVISOR HAVE MANY + ENTERIES OF VM CREDENTIONALS IN THE VARAIABLE FILE OF HYPERVISOR. IN + SEPARATE WE CAN CREATE NEW EVERY TIME + """ + print("VM credential section") + #ENTER VM INFORMATION IF VARIABLE FILE FOR ANSIBLE PLAYBOOK + guestvm_username = " guestvm_username: \"" + vm_username + "\"\n" + guestvm_password = " guestvm_password: \"" + vm_password + "\"\n" + #To empty variable file - temp_command = ">" + ansible_variablefile - os.system(">variablefile") + variableFilePath = ansible_playbookPath + "vmvariablefile" + temp_command = ">" + variableFilePath + os.system(temp_command) #empty file - variablefile = open(ansible_variablefile,"a") - variablefile.write(server_hostname) - variablefile.write(server_username) - variablefile.write(server_password) + variablefile = open(variableFilePath,"a") + variablefile.write(guestvm_username) + variablefile.write(guestvm_password) variablefile.close() + def vm_patchCommands(self, patch_commands, ansible_playbookPath): + + cmd_arr_name = "run_commands:\n" + #To empty variable file + + patchfilePath = ansible_playbookPath + "patchCommand.yml" + temp_command = ">" + patchfilePath + os.system(temp_command) #empty file + + patchfile = open(patchfilePath,"a") + patch_commandlist = patch_commands.split('\n') + + patchfile.write(cmd_arr_name) + for command in patch_commandlist: + temp_cmd = command.replace('\r', '') + patchfile.write(' - "' + temp_cmd + ' 2>&1 | tee -a out.log "\n') + patchfile.close() + + + #ANSIBLE PLAYBOOK EXECUTION COMMANDS FUNCTIOIN def vmInfo(self): getVmInformation() - -os.system("cat playbook/patching/vmInfo.yml") + def vmPatch(self): + startpatch() diff --git a/static/css/patch_panel.css b/static/css/patch_panel.css index 3528ada..9c9550b 100644 --- a/static/css/patch_panel.css +++ b/static/css/patch_panel.css @@ -35,14 +35,8 @@ header{ } #connectHypButton{ - width: 200px; - height: 40px; margin-left: 70%; margin-bottom: 3%; - background-color: green; - color: white; - border: solid green; - border-radius: 20px; cursor: pointer; } @@ -53,37 +47,23 @@ header{ } #selectVMbutton{ - width: 210px; - height: 40px; - margin-left: 68%; + margin-left: 67%; margin-bottom: 2%; - background-color: green ; - color: white; - border: solid green ; - border-radius: 20px; cursor: pointer; } #patchTextarea{ - height: 70vh; + height: 57vh; } #executeButton{ float: right; - width: 200px; - height: 40px; margin-right: 1%; margin-bottom: 3%; - background-color: red; - color: white; - border: solid red; - border-radius: 20px; cursor: pointer; } .col{ height:85vh; - border: 1px solid black; - border-radius: 20px; margin: 1px; clear:both; /*overflow: auto;*/ diff --git a/templates/patching/index.html b/templates/patching/index.html index e071c7e..3b83f67 100644 --- a/templates/patching/index.html +++ b/templates/patching/index.html @@ -6,5 +6,10 @@
This is our application. +