3 - name: Create VirtualBMC directories
12 - "/var/log/virtualbmc"
15 - name: Create VirtualBMC configuration file
18 dest: "/etc/virtualbmc/virtualbmc.conf"
21 config_dir=/root/.vbmc
23 logfile=/var/log/virtualbmc/virtualbmc.log
29 - name: get virthost non_root_user userid
30 command: id -u {{ non_root_user }}
31 register: non_root_user_uid
33 - name: set fact on non_root_user_uid
35 non_root_user_uid: "{{ non_root_user_uid.stdout }}"
37 # The first network defined with an address will be used for vbmc access.
38 - name: set vbmc address if there is a (nat) network defined with an address
40 vbmc_address: "{{ networks|selectattr('address', 'defined')|map(attribute='address')|list|first }}"
41 when: networks|selectattr('address', 'defined')|map(attribute='name')|list|length > 0
43 # The connection uri is slightly different when using qemu:///system
44 # and requires the root user.
45 - name: set qemu uri for qemu:///system usage
47 vbmc_libvirt_uri: "qemu+ssh://root@{{ vbmc_address }}/system?&keyfile=/root/.ssh/id_rsa_virt_power&no_verify=1&no_tty=1"
48 when: libvirt_uri == "qemu:///system"
50 - name: set qemu uri for qemu:///session usage
52 vbmc_libvirt_uri: "qemu+ssh://{{ non_root_user }}@{{ vbmc_address }}/session?socket=/run/user/{{ non_root_user_uid }}/libvirt/libvirt-sock&keyfile=/root/.ssh/id_rsa_virt_power&no_verify=1&no_tty=1"
53 when: vbmc_libvirt_uri is not defined
55 - name: Start the Virtual BMCs (virtualbmc >= 1.4.0+) on Redhat-family OSes
61 - ansible_os_family == "RedHat"
64 - name: Start the Virtual BMCs (virtualbmc >= 1.4.0+) on ubuntu
67 - ansible_facts['distribution'] == "Ubuntu"
71 - name: Create the Virtual BMCs
72 command: "vbmc add {{ item.name }} --port {{ item.virtualbmc_port }} --libvirt-uri {{ vbmc_libvirt_uri }}"
74 creates: /root/.vbmc/{{ item.name }}/config
75 with_items: "{{ vm_nodes }}"
78 PATH: "{{ ansible_env.PATH }}:/usr/local/bin"
80 - name: Start the Virtual BMCs
81 script: vbmc_start.sh {{ item.name }}
82 with_items: "{{ vm_nodes }}"