allow passwordless Sudo for user
This commit is contained in:
parent
7070e183ae
commit
3faf0525a8
4 changed files with 22 additions and 10 deletions
|
|
@ -5,9 +5,9 @@ import json, os, os.path, sys, stat, subprocess
|
|||
|
||||
if not os.path.isfile("/media/host/.vminfo.json"):
|
||||
try:
|
||||
subprocess.run(["/usr/bin/mount", "-t", "virtiofs", "VM-Data", "/media/host"])
|
||||
except:
|
||||
subprocess.run(["/usr/bin/mount", "-t", "virtiofs", "Home_Linux", "/media/host"])
|
||||
subprocess.run(["/usr/bin/mount", "-t", "virtiofs", "VM-Data", "/media/host"], check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
subprocess.run(["/usr/bin/mount", "-t", "virtiofs", "Home_Linux", "/media/host"], check=True)
|
||||
|
||||
if not os.path.isfile("/media/host/.vminfo.json"):
|
||||
print("/media/host/.vminfo.json not found",file=sys.stderr)
|
||||
|
|
@ -44,4 +44,4 @@ for mount in mounts:
|
|||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
if not os.path.ismount(directory):
|
||||
subprocess.run(["/usr/bin/mount", "-t", "cifs", mount['RemotePath'], directory ,"-o", f"sec=krb5i,username={user},cruid=1000,uid=1000,gid=1000"])
|
||||
subprocess.run(["/usr/bin/mount", "-t", "cifs", mount['RemotePath'], directory ,"-o", f"sec=krb5i,username={user},cruid=1000,uid=1000,gid=1000"], check=True)
|
||||
|
|
|
|||
|
|
@ -6,4 +6,6 @@ Requires=network-online.target
|
|||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/python3 /usr/local/bin/lmn-parse-vminfo
|
||||
RemainAfterExit=false
|
||||
RemainAfterExit=yes
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
name:
|
||||
- cifs-utils
|
||||
- krb5-user
|
||||
- python3-pip
|
||||
# - python3-pip
|
||||
- python3-impacket
|
||||
|
||||
- name: Provide lmn-parse-vminfo script
|
||||
ansible.builtin.copy:
|
||||
|
|
@ -13,10 +14,10 @@
|
|||
dest: /usr/local/bin/lmn-parse-vminfo
|
||||
mode: '0755'
|
||||
|
||||
- name: Install impacket pip package
|
||||
ansible.builtin.pip:
|
||||
name: impacket
|
||||
break_system_packages: true
|
||||
# - name: Install impacket pip package
|
||||
# ansible.builtin.pip:
|
||||
# name: impacket
|
||||
# break_system_packages: true
|
||||
|
||||
- name: Provide lmn-vminfo.service and timer
|
||||
ansible.builtin.copy:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue