Exemple #1
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

INTERFACE = 'vmbr1'

STATUS = PROXMOX_EXEC.get_cluster_backup_schedule()
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #2
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

VMID = '102'

STATUS = PROXMOX_EXEC.shutdown_virtual_machine(NODE, VMID)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STORAGE = 'local_data'

STATUS = PROXMOX_EXEC.get_node_storage_content(NODE, STORAGE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #4
0
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

NEXT_ID = PROXMOX_EXEC.get_cluster_vm_next_id()
NEXT_ID = json.loads(NEXT_ID)
NEXT_ID = NEXT_ID["data"]

STORAGE = 'Stockage1'
FILENAME = "vm-{}-disk-0.qcow2".format(NEXT_ID)
SIZE = '32G'

POST_DATA = {
    'vmid': NEXT_ID,
    'cores': '2',
    'sockets': 1,
    'description': 'test kvm',
    'name': 'test.example.org',
Exemple #5
0
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS_NEXTID = PROXMOX_EXEC.get_cluster_vm_next_id()
RESULT_STATUS_NEXTID = json.loads(STATUS_NEXTID)
NEXTID = RESULT_STATUS_NEXTID["data"]

VMID = '102'
POST_DATA = {'newid': NEXTID, 'node': NODE, 'vmid': VMID}

print("New VMID : {}".format(NEXTID))
STATUS = PROXMOX_EXEC.clone_virtual_machine(NODE, VMID, POST_DATA)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

VMID = '102'
SNAPNAME = 'snapshotTest'

STATUS = PROXMOX_EXEC.delete_snapshot_virtual_machine(NODE,
                                                      VMID,
                                                      SNAPNAME,
                                                      force=False)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #7
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

POST_DATA = {'iface': 'vmbr6', 'type': 'bridge', 'comments': 'Test vmbr'}

STATUS = PROXMOX_EXEC.create_node_network(NODE, POST_DATA)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #8
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

VMID = '9005'

STATUS = PROXMOX_EXEC.stop_lxc_container(NODE, VMID)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #9
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.migrate_virtual_machine(NODE, '104', 'r710-2', online=False, force=False)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #10
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.get_cluster_node_list()
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.get_node_scan_methods(NODE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #12
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.migrate_lxc_container(NODE, '9002', 'r710-2')
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.delete_node_network_config(NODE, 'vmbr5')
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #14
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

VMID = '102'

STATUS = PROXMOX_EXEC.resume_virtual_machine(NODE, VMID)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #15
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STORAGE = 'local_data'

STATUS = PROXMOX_EXEC.get_storage_config(STORAGE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #16
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

INTERFACE = 'vmbr1'

STATUS = PROXMOX_EXEC.get_node_interface(NODE, INTERFACE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

VMID = '102'
SNAPNAME = 'snapshotTest'

STATUS = PROXMOX_EXEC.get_snapshot_config_virtual_machine(NODE, VMID, SNAPNAME)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #18
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STORAGE = 'local_data'
VOLUME = 'local_data:141/vm-141-disk-0.qcow2'

STATUS = PROXMOX_EXEC.get_storage_volume_data(NODE, STORAGE, VOLUME)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #19
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.get_node_service_list(NODE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

VMID = '102'

STATUS = PROXMOX_EXEC.get_snapshots_virtual_machine(NODE, VMID)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #21
0
if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

VMID = '102'
SNAPNAME = 'snapshotTest'

STATUS = PROXMOX_EXEC.create_snapshot_virtual_machine(
    NODE, VMID, SNAPNAME, description='Snapshot test', vmstate=False)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #22
0
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

IFACE = 'vmbr6'
POST_DATA = {'iface': IFACE, 'node': NODE, 'type': 'bridge'}

STATUS = PROXMOX_EXEC.reload_node_iface(NODE, IFACE, POST_DATA)
print(STATUS)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #23
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.get_cluster_acl()
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

POST_DATA = {'iface': 'vmbr6', 'node': NODE, 'type': 'bridge'}

STATUS = PROXMOX_EXEC.reload_node_network(NODE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.get_node_virtual_index(NODE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #26
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.delete_lxc_container(NODE, '9003')
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #27
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.get_node_finished_tasks(NODE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #28
0
# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

SERVICE = 'ksmtuned'

STATUS = PROXMOX_EXEC.get_node_service_state(NODE, SERVICE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #29
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.get_node_dns(NODE)
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])
Exemple #30
0
from urllib3.exceptions import InsecureRequestWarning
from proxmox import ProxAuth, PyProxmox

# Read conf.ini
INI_CONF = "./proxmox_api.ini"

if not pathlib.Path(INI_CONF).exists():
    print("Config file not found!")
    print("Need the config file in {}".format(INI_CONF))
    sys.exit(1)

CONFIG = ConfigParser()
CONFIG.read(INI_CONF)

# DB parameters
URL = CONFIG.get('api', 'ipaddress')
USERAPI = CONFIG.get('api', 'user')
PASSWORD = CONFIG.get('api', 'passwd')
NODE = CONFIG.get('api', 'node')

disable_warnings(InsecureRequestWarning)

INIT_AUTHENT = ProxAuth(URL, USERAPI, PASSWORD)

PROXMOX_EXEC = PyProxmox(INIT_AUTHENT)

STATUS = PROXMOX_EXEC.get_cluster_vm_next_id()
RESULT_STATUS = json.loads(STATUS)
print(RESULT_STATUS["data"])
print(RESULT_STATUS["status"]["code"])