How I resize hard disk with ansible module proxmox_kvmWhy Ansible ignores ansible_become_password variable?AWS provision with ansibleAnsible not detecting Role default variables in its handleransible playbook: how can I inherit a set of options common to a set of tasksAnsible Script Module Not Interpreting VariableAnsible to Proxmox returning 500 errorAnsible variables assign to hostError while using vars_prompt in ansible playbookAnsible pops up with an error “PyVmomi Python module required.”
Asking bank to reduce APR instead of increasing credit limit
Orientable with respect to complex cobordism?
Strange math syntax in old basic listing
What is a simple, physical situation where complex numbers emerge naturally?
What people are called "кабан" and why?
Explain Ant-Man's "not it" scene from Avengers: Endgame
California: "For quality assurance, this phone call is being recorded"
What if you don't bring your credit card or debit for incidentals?
Joist hangers to use for rough cut 2x8 (2 3/4" x 8 3/4")?
How do I get a list of only the files (not the directories) from a package?
Can an old DSLR be upgraded to match modern smartphone image quality
Constructing a CCY Gate
Estimate related to the Möbius function
Is there a way to save this session?
What does War Machine's "Canopy! Canopy!" line mean in "Avengers: Endgame"?
Scala list with same adjacent values
Coding Challenge Solution - Good Range
Why don't I have ground wiring on any of my outlets?
Accidentally cashed a check twice
Select row of data if next row contains zero
Recording the inputs of a command and producing a list of them later on
Could a guilty Boris Johnson be used to cancel Brexit?
If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?
What caused the tendency for conservatives to not support climate change regulations?
How I resize hard disk with ansible module proxmox_kvm
Why Ansible ignores ansible_become_password variable?AWS provision with ansibleAnsible not detecting Role default variables in its handleransible playbook: how can I inherit a set of options common to a set of tasksAnsible Script Module Not Interpreting VariableAnsible to Proxmox returning 500 errorAnsible variables assign to hostError while using vars_prompt in ansible playbookAnsible pops up with an error “PyVmomi Python module required.”
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I've created a 8Gb disksize ProxMox VM template. Using ansible module proxmo_kvm I clone it but I can't resize the SCSI disk. Is it possible to do ? if it is could you give me some explanations to understand how ?
Project file hierarchy:
.
├── playbook.yml
└─── proxmox-vm/
├── tasks/
│ └── main.yml
└── vars/
└── main.yml
playbook.yml
:
- hosts: localhost
connection: local
roles:
- proxmox-vm
proxmox-vm/vars/main.yml
:
---
# vars file for proxmox-vm
proxmox:
api:
host: 127.0.0.1
user: 'user@pam'
password: 'password'
node: workstation
vm:
name: test-debian
clone: debian-9.8
full: yes
scsi:
size: 16G
proxmox-vm/tasks/main.yml
:
---
# tasks file for proxmox-vm
- name: create VM from template
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node "
name: " proxmox.vm.name "
clone: " proxmox.vm.clone "
full: yes
scsi: " proxmox.vm.scsi "
Running Ansible playbook:
ansible-playbook playbook.yml
PLAY [localhost] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [proxmox-vm : create VM from template] ************************************
changed: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
I'm expecting a new 16Gb disksize VM, but the actual disksize is 8Gb (initial disksize template)
ansible kvm proxmox
add a comment |
I've created a 8Gb disksize ProxMox VM template. Using ansible module proxmo_kvm I clone it but I can't resize the SCSI disk. Is it possible to do ? if it is could you give me some explanations to understand how ?
Project file hierarchy:
.
├── playbook.yml
└─── proxmox-vm/
├── tasks/
│ └── main.yml
└── vars/
└── main.yml
playbook.yml
:
- hosts: localhost
connection: local
roles:
- proxmox-vm
proxmox-vm/vars/main.yml
:
---
# vars file for proxmox-vm
proxmox:
api:
host: 127.0.0.1
user: 'user@pam'
password: 'password'
node: workstation
vm:
name: test-debian
clone: debian-9.8
full: yes
scsi:
size: 16G
proxmox-vm/tasks/main.yml
:
---
# tasks file for proxmox-vm
- name: create VM from template
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node "
name: " proxmox.vm.name "
clone: " proxmox.vm.clone "
full: yes
scsi: " proxmox.vm.scsi "
Running Ansible playbook:
ansible-playbook playbook.yml
PLAY [localhost] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [proxmox-vm : create VM from template] ************************************
changed: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
I'm expecting a new 16Gb disksize VM, but the actual disksize is 8Gb (initial disksize template)
ansible kvm proxmox
add a comment |
I've created a 8Gb disksize ProxMox VM template. Using ansible module proxmo_kvm I clone it but I can't resize the SCSI disk. Is it possible to do ? if it is could you give me some explanations to understand how ?
Project file hierarchy:
.
├── playbook.yml
└─── proxmox-vm/
├── tasks/
│ └── main.yml
└── vars/
└── main.yml
playbook.yml
:
- hosts: localhost
connection: local
roles:
- proxmox-vm
proxmox-vm/vars/main.yml
:
---
# vars file for proxmox-vm
proxmox:
api:
host: 127.0.0.1
user: 'user@pam'
password: 'password'
node: workstation
vm:
name: test-debian
clone: debian-9.8
full: yes
scsi:
size: 16G
proxmox-vm/tasks/main.yml
:
---
# tasks file for proxmox-vm
- name: create VM from template
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node "
name: " proxmox.vm.name "
clone: " proxmox.vm.clone "
full: yes
scsi: " proxmox.vm.scsi "
Running Ansible playbook:
ansible-playbook playbook.yml
PLAY [localhost] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [proxmox-vm : create VM from template] ************************************
changed: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
I'm expecting a new 16Gb disksize VM, but the actual disksize is 8Gb (initial disksize template)
ansible kvm proxmox
I've created a 8Gb disksize ProxMox VM template. Using ansible module proxmo_kvm I clone it but I can't resize the SCSI disk. Is it possible to do ? if it is could you give me some explanations to understand how ?
Project file hierarchy:
.
├── playbook.yml
└─── proxmox-vm/
├── tasks/
│ └── main.yml
└── vars/
└── main.yml
playbook.yml
:
- hosts: localhost
connection: local
roles:
- proxmox-vm
proxmox-vm/vars/main.yml
:
---
# vars file for proxmox-vm
proxmox:
api:
host: 127.0.0.1
user: 'user@pam'
password: 'password'
node: workstation
vm:
name: test-debian
clone: debian-9.8
full: yes
scsi:
size: 16G
proxmox-vm/tasks/main.yml
:
---
# tasks file for proxmox-vm
- name: create VM from template
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node "
name: " proxmox.vm.name "
clone: " proxmox.vm.clone "
full: yes
scsi: " proxmox.vm.scsi "
Running Ansible playbook:
ansible-playbook playbook.yml
PLAY [localhost] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [localhost]
TASK [proxmox-vm : create VM from template] ************************************
changed: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
I'm expecting a new 16Gb disksize VM, but the actual disksize is 8Gb (initial disksize template)
ansible kvm proxmox
ansible kvm proxmox
edited Apr 6 at 19:03
Mikael Flora
asked Mar 24 at 10:53
Mikael FloraMikael Flora
1214
1214
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Currently it is not possible because ansible module proxmox_kvm does't allow it (neither for clone
nor for update
). See the source code of the module (proxmox_kvm.py
):
# [...]
def create_vm(module, proxmox, vmid, newid, node, name, memory, cpu, cores, sockets, timeout, update, **kwargs):
# [...]
# valide clone parameters
valid_clone_params = ['format', 'full', 'pool', 'snapname', 'storage', 'target']
# [...]
elif module.params['clone'] is not None:
for param in valid_clone_params:
if module.params[param] is not None:
clone_params[param] = module.params[param]
clone_params.update(dict([k, int(v)] for k, v in clone_params.items() if isinstance(v, bool)))
taskid = proxmox_node.qemu(vmid).clone.post(newid=newid, name=name, **clone_params)
# [...]
# If update, don't update disk (virtio, ide, sata, scsi) and network interface
if update:
# [...]
if 'scsi' in kwargs:
del kwargs['scsi']
# [...]
add a comment |
It's possible with ansible module uri. Add following tasks to the file proxmox-vm/tasks/main.yml
:
# get VMID
- name: get VM state
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node"
name: " proxmox.vm.name "
state: current
register: result
- name: set fact VMID
set_fact:
vmid: " regex_replace('.*vmid = ([1-9][0-9]0,3).*', '\1') "
# Authentication
- name: authentication
uri:
url: "https:// proxmox.api.host :8006/api2/json/access/ticket"
method: POST
body_format: form-urlencoded
body:
username: " proxmox.api.user "
password: " proxmox.api.password "
register: auth
# Resize disk
- name: resize disk
uri:
url: "https:// proxmox.api.host :8006/api2/json/nodes/ proxmox.node /qemu/ vmid /resize"
method: PUT
headers:
Cookie: "PVEAuthCookie= auth.json.data.ticket "
CSRFPreventionToken: " auth.json.data.CSRFPreventionToken "
body_format: form-urlencoded
body:
disk: scsi0
size: " proxmox.vm.scsi.size "
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323050%2fhow-i-resize-hard-disk-with-ansible-module-proxmox-kvm%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Currently it is not possible because ansible module proxmox_kvm does't allow it (neither for clone
nor for update
). See the source code of the module (proxmox_kvm.py
):
# [...]
def create_vm(module, proxmox, vmid, newid, node, name, memory, cpu, cores, sockets, timeout, update, **kwargs):
# [...]
# valide clone parameters
valid_clone_params = ['format', 'full', 'pool', 'snapname', 'storage', 'target']
# [...]
elif module.params['clone'] is not None:
for param in valid_clone_params:
if module.params[param] is not None:
clone_params[param] = module.params[param]
clone_params.update(dict([k, int(v)] for k, v in clone_params.items() if isinstance(v, bool)))
taskid = proxmox_node.qemu(vmid).clone.post(newid=newid, name=name, **clone_params)
# [...]
# If update, don't update disk (virtio, ide, sata, scsi) and network interface
if update:
# [...]
if 'scsi' in kwargs:
del kwargs['scsi']
# [...]
add a comment |
Currently it is not possible because ansible module proxmox_kvm does't allow it (neither for clone
nor for update
). See the source code of the module (proxmox_kvm.py
):
# [...]
def create_vm(module, proxmox, vmid, newid, node, name, memory, cpu, cores, sockets, timeout, update, **kwargs):
# [...]
# valide clone parameters
valid_clone_params = ['format', 'full', 'pool', 'snapname', 'storage', 'target']
# [...]
elif module.params['clone'] is not None:
for param in valid_clone_params:
if module.params[param] is not None:
clone_params[param] = module.params[param]
clone_params.update(dict([k, int(v)] for k, v in clone_params.items() if isinstance(v, bool)))
taskid = proxmox_node.qemu(vmid).clone.post(newid=newid, name=name, **clone_params)
# [...]
# If update, don't update disk (virtio, ide, sata, scsi) and network interface
if update:
# [...]
if 'scsi' in kwargs:
del kwargs['scsi']
# [...]
add a comment |
Currently it is not possible because ansible module proxmox_kvm does't allow it (neither for clone
nor for update
). See the source code of the module (proxmox_kvm.py
):
# [...]
def create_vm(module, proxmox, vmid, newid, node, name, memory, cpu, cores, sockets, timeout, update, **kwargs):
# [...]
# valide clone parameters
valid_clone_params = ['format', 'full', 'pool', 'snapname', 'storage', 'target']
# [...]
elif module.params['clone'] is not None:
for param in valid_clone_params:
if module.params[param] is not None:
clone_params[param] = module.params[param]
clone_params.update(dict([k, int(v)] for k, v in clone_params.items() if isinstance(v, bool)))
taskid = proxmox_node.qemu(vmid).clone.post(newid=newid, name=name, **clone_params)
# [...]
# If update, don't update disk (virtio, ide, sata, scsi) and network interface
if update:
# [...]
if 'scsi' in kwargs:
del kwargs['scsi']
# [...]
Currently it is not possible because ansible module proxmox_kvm does't allow it (neither for clone
nor for update
). See the source code of the module (proxmox_kvm.py
):
# [...]
def create_vm(module, proxmox, vmid, newid, node, name, memory, cpu, cores, sockets, timeout, update, **kwargs):
# [...]
# valide clone parameters
valid_clone_params = ['format', 'full', 'pool', 'snapname', 'storage', 'target']
# [...]
elif module.params['clone'] is not None:
for param in valid_clone_params:
if module.params[param] is not None:
clone_params[param] = module.params[param]
clone_params.update(dict([k, int(v)] for k, v in clone_params.items() if isinstance(v, bool)))
taskid = proxmox_node.qemu(vmid).clone.post(newid=newid, name=name, **clone_params)
# [...]
# If update, don't update disk (virtio, ide, sata, scsi) and network interface
if update:
# [...]
if 'scsi' in kwargs:
del kwargs['scsi']
# [...]
edited Mar 24 at 18:21
answered Mar 24 at 18:12
Mikael FloraMikael Flora
1214
1214
add a comment |
add a comment |
It's possible with ansible module uri. Add following tasks to the file proxmox-vm/tasks/main.yml
:
# get VMID
- name: get VM state
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node"
name: " proxmox.vm.name "
state: current
register: result
- name: set fact VMID
set_fact:
vmid: " regex_replace('.*vmid = ([1-9][0-9]0,3).*', '\1') "
# Authentication
- name: authentication
uri:
url: "https:// proxmox.api.host :8006/api2/json/access/ticket"
method: POST
body_format: form-urlencoded
body:
username: " proxmox.api.user "
password: " proxmox.api.password "
register: auth
# Resize disk
- name: resize disk
uri:
url: "https:// proxmox.api.host :8006/api2/json/nodes/ proxmox.node /qemu/ vmid /resize"
method: PUT
headers:
Cookie: "PVEAuthCookie= auth.json.data.ticket "
CSRFPreventionToken: " auth.json.data.CSRFPreventionToken "
body_format: form-urlencoded
body:
disk: scsi0
size: " proxmox.vm.scsi.size "
add a comment |
It's possible with ansible module uri. Add following tasks to the file proxmox-vm/tasks/main.yml
:
# get VMID
- name: get VM state
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node"
name: " proxmox.vm.name "
state: current
register: result
- name: set fact VMID
set_fact:
vmid: " regex_replace('.*vmid = ([1-9][0-9]0,3).*', '\1') "
# Authentication
- name: authentication
uri:
url: "https:// proxmox.api.host :8006/api2/json/access/ticket"
method: POST
body_format: form-urlencoded
body:
username: " proxmox.api.user "
password: " proxmox.api.password "
register: auth
# Resize disk
- name: resize disk
uri:
url: "https:// proxmox.api.host :8006/api2/json/nodes/ proxmox.node /qemu/ vmid /resize"
method: PUT
headers:
Cookie: "PVEAuthCookie= auth.json.data.ticket "
CSRFPreventionToken: " auth.json.data.CSRFPreventionToken "
body_format: form-urlencoded
body:
disk: scsi0
size: " proxmox.vm.scsi.size "
add a comment |
It's possible with ansible module uri. Add following tasks to the file proxmox-vm/tasks/main.yml
:
# get VMID
- name: get VM state
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node"
name: " proxmox.vm.name "
state: current
register: result
- name: set fact VMID
set_fact:
vmid: " regex_replace('.*vmid = ([1-9][0-9]0,3).*', '\1') "
# Authentication
- name: authentication
uri:
url: "https:// proxmox.api.host :8006/api2/json/access/ticket"
method: POST
body_format: form-urlencoded
body:
username: " proxmox.api.user "
password: " proxmox.api.password "
register: auth
# Resize disk
- name: resize disk
uri:
url: "https:// proxmox.api.host :8006/api2/json/nodes/ proxmox.node /qemu/ vmid /resize"
method: PUT
headers:
Cookie: "PVEAuthCookie= auth.json.data.ticket "
CSRFPreventionToken: " auth.json.data.CSRFPreventionToken "
body_format: form-urlencoded
body:
disk: scsi0
size: " proxmox.vm.scsi.size "
It's possible with ansible module uri. Add following tasks to the file proxmox-vm/tasks/main.yml
:
# get VMID
- name: get VM state
proxmox_kvm:
api_host: " proxmox.api.host "
api_user: " proxmox.api.user "
api_password: " proxmox.api.password "
node: " proxmox.node"
name: " proxmox.vm.name "
state: current
register: result
- name: set fact VMID
set_fact:
vmid: " regex_replace('.*vmid = ([1-9][0-9]0,3).*', '\1') "
# Authentication
- name: authentication
uri:
url: "https:// proxmox.api.host :8006/api2/json/access/ticket"
method: POST
body_format: form-urlencoded
body:
username: " proxmox.api.user "
password: " proxmox.api.password "
register: auth
# Resize disk
- name: resize disk
uri:
url: "https:// proxmox.api.host :8006/api2/json/nodes/ proxmox.node /qemu/ vmid /resize"
method: PUT
headers:
Cookie: "PVEAuthCookie= auth.json.data.ticket "
CSRFPreventionToken: " auth.json.data.CSRFPreventionToken "
body_format: form-urlencoded
body:
disk: scsi0
size: " proxmox.vm.scsi.size "
answered Apr 6 at 19:15
Mikael FloraMikael Flora
1214
1214
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55323050%2fhow-i-resize-hard-disk-with-ansible-module-proxmox-kvm%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown