Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovirt_vm parameter cloud_init does not set hostname or root password #69580

Closed
eddy-resnick opened this issue May 18, 2020 · 8 comments
Closed
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. cloud collection Related to Ansible Collections work module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md ovirt oVirt and RHV community support:community This issue/PR relates to code supported by the Ansible community. system System category

Comments

@eddy-resnick
Copy link

eddy-resnick commented May 18, 2020

SUMMARY

Using the ovirt_vm module and the cloud_init parameter to set hostname and root password has no effect on newly created VM from template
Using Ansible 2.7.18 with the python-ovirt-engine-sdk4-4.3.2-1.el7ev.x86_64 installed.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Module: ovirt_vm
Parameter: cloud_init hostname
Parameter: cloud_init root_password

ANSIBLE VERSION
ansible 2.7.18
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Sep 26 2019, 13:23:47) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = [u'/etc/ansible/roles', u'/usr/share/ansible/roles']
OS / ENVIRONMENT

RHEL 7 with Ansible Tower

  • VM template is RHEV 7
STEPS TO REPRODUCE

I've tried this with and without the cloud_init_persist parameter set.
The documentation is not very clear.

---
- name: Create VM on RHV
  hosts: localhost
  connection: local
  gather_facts: false

  vars_files:
    - rhvm_vars.yml
    - password.yml

  pre_tasks:
    - name: Log in to oVirt
      ovirt_auth:
        hostname: "{{ rhvm_fqdn }}"
        username: "{{ rhvm_user }}"
        password: "{{ rhvm_password }}"
        ca_file: "{{ rhvm_cafile | default(omit) }}"
        insecure: "{{ rhvm_insecure | default(true) }}"
      tags:
        - always

  vars:
    datacenter: "{{ rhvm_fqdn }}"
    cluster: Default
    vm_memory: 1GiB

  tasks:
  - name: Create and run VM from template
    ovirt_vm:
      auth: "{{ ovirt_auth }}"
      name: "{{ rhvm_vm_name }}"
      template: "{{ rhvm_template }}"
      cluster: "{{ cluster }}"
      memory: "{{ vm_memory }}"
      host: "{{ rhvm_sat_host }}"
      high_availability: no
      state: running
      wait: yes
      cloud_init_persist: yes
      cloud_init:
        host_name: "{{ rhvm_vm_name }}"
        user_name: root
        root_password: "{{ rhvm_password }}"

  post_tasks:
  - name: Log out from oVirt
    ovirt_auth:
      state: absent
      ovirt_auth: "{{ ovirt_auth }}"
    tags:
      - always

---
rhvm_password: redhat


---
rhvm_fqdn: ovirtmanager.habana-labs.com
rhvm_user: admin@internal
rhvm_cafile: /etc/pki/ovirt-engine/ca.pem

rhvm_sat_host: kvm2.habana-labs.com
rhvm_vm_name: A0.habana-labs.com
rhvm_template: Test-small_HPC

EXPECTED RESULTS

I expect to have the VM FQDN to be the same as the VM name in RHEV. I also expect that the root password now to be redhat and not what was in the template.

ACTUAL RESULTS

There is no error generated.
The FQDN is the name of the template and the root password stays what was in the template.

@ansibot
Copy link
Contributor

ansibot commented May 18, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. cloud collection Related to Ansible Collections work collection:mnecas.ovirt module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. ovirt oVirt and RHV community support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category labels May 18, 2020
@mkrizek
Copy link
Contributor

mkrizek commented May 18, 2020

!component =lib/ansible/modules/cloud/ovirt/ovirt_vm.py

@eddy-resnick
Copy link
Author

Correct!

@eddy-resnick
Copy link
Author

I noticed there were bug fixes #47348 and #45900 who were supposed to have fixed this but I still see the problem.

@ansibot
Copy link
Contributor

ansibot commented May 18, 2020

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels May 18, 2020
@eddy-resnick
Copy link
Author

Is anyone looking at this issue?

@mkrizek
Copy link
Contributor

mkrizek commented May 21, 2020

Thank you very much for your interest in Ansible. This plugin is no longer maintained in this repository and has been migrated to https://github.com/oVirt/ovirt-ansible-collection.

Please re-submit this issue in the above repository.

If you have further questions please stop by IRC or the mailing list:

@mkrizek mkrizek closed this as completed May 21, 2020
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label May 21, 2020
@eddy-resnick
Copy link
Author

eddy-resnick commented May 21, 2020 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. cloud collection Related to Ansible Collections work module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md ovirt oVirt and RHV community support:community This issue/PR relates to code supported by the Ansible community. system System category
Projects
None yet
Development

No branches or pull requests

3 participants