Skip to content

runcmd module not working #750

@mohanrajbma

Description

@mohanrajbma
SUMMARY

Using ovirt_vm module, I am trying to create a new VM in OLVM and run scripts on first boot using runcmd module, VM is created fine but runcmd module not working, it does not run the script.

other cloud-init module such as write_files, users are working fine. I am referring this examples - https://cloudinit.readthedocs.io/en/latest/reference/examples.html

versions-
olvm - 4.5.4-1.0.31.el8
oracle linux template - 8.8
cloud-init -22.1-6.0.2.el8-7.2
Ansible - 2.9.27
ovirt.ovirt collection - 3.2.0

COMPONENT NAME

ovirt_vm.py

STEPS TO REPRODUCE
- name: create VM in OLVM using Ansible
  ovirt.ovirt.ovirt_vm:
    name: "{{ vm_name }}"
    cluster: "{{ OLVM }}"
    state: running
    template: "{{ Template }}"
    operating_system: "{{ olvm_os }}"
    memory: "{{ memoryGb }}GiB"
    cpu_cores: "{{ vcpus }}"
    type: "{{ vmType }}"
    nics: "{{ NetworkList }}"
    cloud_init_persist: true
    wait: true
    cloud_init:
      host_name: "{{ vm_name}}"
      custom_script: |
        runcmd:
          - mkdir /run/mydir
        write_files:
          - content: |
              Hello, world!
            path: /tmp/greeting.txt
            permissions: '0644'
EXPECTED RESULTS

both the directory /run/mydir and file /tmp/greeting.txt gets created.

ACTUAL RESULTS
file /tmp/greeting.txt gets created
 directory /run/mydir does not get created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions