From b20f5543ced06ada578c157010e2214eed8d318a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Dupr=C3=A9?= Date: Wed, 18 Dec 2024 16:55:25 +0100 Subject: [PATCH] roles: add variables documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the role's documentations to include the variables that can be set for each role. Also move the default variables values which were in the playbooks to the roles themselves. Signed-off-by: Mathieu Dupré --- playbooks/cluster_setup_libvirt.yaml | 3 - roles/add_livemigration_user/README.md | 8 ++- roles/ceph_expansion_lv/README.md | 11 +++- roles/configure_admin_user/README.md | 9 ++- roles/configure_admin_user/meta/main.yml | 4 ++ roles/configure_ha/README.md | 26 ++++++-- roles/configure_ha/defaults/main.yml | 6 ++ roles/configure_ha/meta/main.yml | 6 ++ roles/configure_ha/tasks/main.yml | 1 - roles/configure_libvirt/README.md | 10 ++-- roles/configure_libvirt/defaults/main.yml | 6 ++ roles/configure_libvirt/meta/main.yml | 8 ++- roles/configure_libvirt/tasks/main.yml | 6 +- .../templates/libvirt_pool.xml.j2 | 4 +- roles/configure_nic_irq_affinity/README.md | 11 +++- .../handlers/main.yml | 11 ++++ .../configure_nic_irq_affinity/meta/main.yml | 7 ++- .../configure_nic_irq_affinity/tasks/main.yml | 13 ++-- roles/conntrackd/README.md | 6 +- roles/conntrackd/meta/main.yml | 4 +- roles/deploy_cukinia/README.md | 4 +- roles/deploy_cukinia/files/cukinia | 2 +- roles/deploy_cukinia_tests/README.md | 4 +- roles/deploy_cukinia_tests/cukinia-tests | 2 +- roles/deploy_python3_setup_ovs/README.md | 4 +- roles/deploy_python3_setup_ovs/meta/main.yml | 4 +- roles/deploy_vm_manager/README.md | 4 +- roles/deploy_vm_manager/files/vm_manager | 2 +- roles/deploy_vm_manager/meta/main.yml | 3 + roles/deploy_vms_cluster/README.md | 60 ++++++++++++++++--- roles/deploy_vms_cluster/defaults/main.yml | 8 +++ roles/deploy_vms_cluster/tasks/main.yml | 6 +- roles/update/README.md | 6 +- 33 files changed, 203 insertions(+), 66 deletions(-) create mode 100644 roles/configure_ha/defaults/main.yml create mode 100644 roles/configure_libvirt/defaults/main.yml create mode 100644 roles/configure_nic_irq_affinity/handlers/main.yml create mode 100644 roles/deploy_vms_cluster/defaults/main.yml diff --git a/playbooks/cluster_setup_libvirt.yaml b/playbooks/cluster_setup_libvirt.yaml index 55d339ca3..5e73db0d9 100644 --- a/playbooks/cluster_setup_libvirt.yaml +++ b/playbooks/cluster_setup_libvirt.yaml @@ -8,8 +8,5 @@ - name: Configure libvirt hosts: hypervisors:&cluster_machines become: true - vars: - rbd_pool_name: "{{ libvirt_rbd_pool | default('rbd') }}" - pool_name: "{{ libvirt_pool_name | default('ceph') }}" roles: - configure_libvirt diff --git a/roles/add_livemigration_user/README.md b/roles/add_livemigration_user/README.md index 383969ba7..46f77389f 100644 --- a/roles/add_livemigration_user/README.md +++ b/roles/add_livemigration_user/README.md @@ -1,6 +1,7 @@ # Add LiveMigration User Role -This role sets the live migration user on the cluster, with ssh key exchanges +This role sets the live migration user on the cluster, with ssh key exchanges. +If the user does not already exist, they will be created. ## Requirements @@ -8,7 +9,10 @@ no requirement. ## Role Variables -- livemigration_user +| Variable | Required | Type | Comments | +|-------------------------|----------|--------|--------------------------------------------------------------------| +| livemigration_user | no | String | The livemigration user. If not defined, the role will do nothing. | + ## Example Playbook diff --git a/roles/ceph_expansion_lv/README.md b/roles/ceph_expansion_lv/README.md index 0c0bdfb5c..31603d221 100644 --- a/roles/ceph_expansion_lv/README.md +++ b/roles/ceph_expansion_lv/README.md @@ -4,11 +4,18 @@ This role extends the ceph LV to whatever is ask in the variables ## Requirements -no requirement. +No requirement. ## Role Variables -- lvm_volumes +| Variable | Required | Type | Comments | +|-------------------------|----------|---------------|--------------------------------------------------------------------| +| lvm_volumes | no | Array of dict | LVM volumes | +| -> data_vg | no |String | TODO | +| -> data | no |String | TODO | +| -> data_size | no |String | TODO | +| ansible_lvm | no | Dict | TODO | + ## Example Playbook diff --git a/roles/configure_admin_user/README.md b/roles/configure_admin_user/README.md index 7afbf4f12..f4157e441 100644 --- a/roles/configure_admin_user/README.md +++ b/roles/configure_admin_user/README.md @@ -1,13 +1,16 @@ -# Configure admin_user Role +# Configure admin user Role This role copy the root ssh key to admin user's. This user is used by Debian when using consolevm. ## Requirements -- detect_seapath_distro +No requirement. ## Role Variables -- admin_user +| Variable | Required | Type | Comments | +|-------------------------|----------|--------|--------------------------------------------------------------------| +| seapath_distro | yes | String | SEAPATH variant. *CentOS*, *Debian* or *Yocto*. The variable can be set automatically using the *detect_seapath_distro role* | +| admin_user | yes | String | The admin user. | ## Example Playbook diff --git a/roles/configure_admin_user/meta/main.yml b/roles/configure_admin_user/meta/main.yml index 65ba30470..e540b300f 100644 --- a/roles/configure_admin_user/meta/main.yml +++ b/roles/configure_admin_user/meta/main.yml @@ -10,5 +10,9 @@ galaxy_info: - name: Debian versions: - all + platforms: + - name: CentOS + versions: + - all dependencies: - role: detect_seapath_distro diff --git a/roles/configure_ha/README.md b/roles/configure_ha/README.md index 027ba013b..1f4fc46dc 100644 --- a/roles/configure_ha/README.md +++ b/roles/configure_ha/README.md @@ -4,21 +4,35 @@ This role configures the High Availability part of a seapath cluster (Corosync a ## Requirements -- detect_seapath_distro +No requirement. ## Role Variables -- corosync_node_list -- tmpdir -- crm_cmd_path -- vmmgrapi_cmd_list -- extra_crm_cmd_to_run +| Variable | Required | Type | Default | Comments | +|-------------------------|----------|-------------|---------|--------------------------------------------------------------------------------| +| seapath_distro | yes | String | | SEAPATH variant. *CentOS*, *Debian* or *Yocto*. The variable can be set automatically using the *detect_seapath_distro role* | +| corosync_node_list | yes | String list | | List of all corosync nodes. Usualy `{{ groups['cluster_machines'] \| list }}` | +| tmpdir | no | String | /tmp | Tempory directory path to use | +| enable_vmmgr_http_api | no | Bool | false | Set to true to enable SEAPATH vm-manager REST API | +| admin_cluster_ip | no | String | | IP of the REST API. If not set the m-manager REST API will be disabled even if `enable_vmmgr_http_api is set to true` | +| extra_crm_cmd_to_run | no | String | | List of `crm configure` commands to run separate by a new line. | ## Example Playbook ```yaml - name: Configure HA hosts: cluster_machines + vars: + corosync_node_list: "{{ groups['cluster_machines'] | list }}" + extra_crm_cmd_to_run: >- + primitive st-1 stonith:external/rackpdu params hostlist=h1 pduip=192.168.3.127 + location l-st-h1 st-1 -inf: h1 + primitive st-2 stonith:eexternal/rackpdu params hostlist=h2 pduip=192.168.3.128 + location l-st-h2 st-2 -inf: h2 + primitive st-3 stonith:eexternal/rackpdu params hostlist=h3 pduip=192.168.3.129 + location l-st-h3 st-3 -inf: h3 + property stonith-enabled=true + roles: - { role: seapath_ansible.configure_ha } ``` diff --git a/roles/configure_ha/defaults/main.yml b/roles/configure_ha/defaults/main.yml new file mode 100644 index 000000000..e3ae5ba02 --- /dev/null +++ b/roles/configure_ha/defaults/main.yml @@ -0,0 +1,6 @@ +# Copyright (C) 2024 Savoir-faire Linux, Inc. +# SPDX-License-Identifier: Apache-2.0 + +--- +tmpdir: "/tmp" +enable_vmmgr_http_api: false diff --git a/roles/configure_ha/meta/main.yml b/roles/configure_ha/meta/main.yml index 26327d7b2..fc1f7549f 100644 --- a/roles/configure_ha/meta/main.yml +++ b/roles/configure_ha/meta/main.yml @@ -8,5 +8,11 @@ galaxy_info: - name: Debian versions: - all + - name: CentOS + versions: + - all + - name: Yocto + versions: + - all dependencies: - role: detect_seapath_distro diff --git a/roles/configure_ha/tasks/main.yml b/roles/configure_ha/tasks/main.yml index 378a9787e..651d71b9c 100644 --- a/roles/configure_ha/tasks/main.yml +++ b/roles/configure_ha/tasks/main.yml @@ -145,7 +145,6 @@ cmd: crm -d config load update - stdin: "{{ vmmgrapi_cmd_list }}" when: - - enable_vmmgr_http_api is defined - enable_vmmgr_http_api is true - admin_cluster_ip is defined run_once: true diff --git a/roles/configure_libvirt/README.md b/roles/configure_libvirt/README.md index 13ab030b4..28bfa6242 100644 --- a/roles/configure_libvirt/README.md +++ b/roles/configure_libvirt/README.md @@ -1,15 +1,17 @@ # Configure Libvirt Role -This role configure the libvirt secret and pool for ceph to use +This role create a libvirt storage pool for ceph. ## Requirements -no requirement. +No requirement. ## Role Variables -- libvirt_rbd_pool -- libvirt_pool_name +| Variable | Required | Type | Default | Comments | +|-------------------------|----------|--------|---------|------------------------------------------------| +| libvirt_rbd_pool | no | String | rbd | The Ceph RBD pool use by libvirts | +| libvirt_pool_name | no | String | ceph | The name of the libvirt storage pool to create | ## Example Playbook diff --git a/roles/configure_libvirt/defaults/main.yml b/roles/configure_libvirt/defaults/main.yml new file mode 100644 index 000000000..c17aa0d47 --- /dev/null +++ b/roles/configure_libvirt/defaults/main.yml @@ -0,0 +1,6 @@ +# Copyright (C) 2024 Savoir-faire Linux, Inc. +# SPDX-License-Identifier: Apache-2.0 + +--- +libvirt_rbd_pool: "rbd" +libvirt_pool_name: "ceph" diff --git a/roles/configure_libvirt/meta/main.yml b/roles/configure_libvirt/meta/main.yml index 6ae03b745..d1b4b8d02 100644 --- a/roles/configure_libvirt/meta/main.yml +++ b/roles/configure_libvirt/meta/main.yml @@ -3,11 +3,17 @@ --- galaxy_info: author: "Seapath" - description: configures the libvirt secret and pool for ceph to use + description: Create a libvirt storage pool for ceph. license: Apache-2.0 min_ansible_version: 2.9.10 platforms: - name: Debian versions: - all + - name: CentOS + versions: + - all + - name: Yocto + versions: + - all dependencies: [] diff --git a/roles/configure_libvirt/tasks/main.yml b/roles/configure_libvirt/tasks/main.yml index 9b71150e8..e3163b12f 100644 --- a/roles/configure_libvirt/tasks/main.yml +++ b/roles/configure_libvirt/tasks/main.yml @@ -71,15 +71,15 @@ community.libvirt.virt_pool: command: define xml: '{{ lookup("template", "libvirt_pool.xml.j2") }}' - name: "{{ pool_name }}" + name: "{{ libvirt_pool_name }}" - name: Start libvirt pool community.libvirt.virt_pool: state: active - name: "{{ pool_name }}" + name: "{{ libvirt_pool_name }}" - name: Autostart pool community.libvirt.virt_pool: autostart: yes - name: "{{ pool_name }}" + name: "{{ libvirt_pool_name }}" - name: Refresh pool command: virsh pool-refresh --pool ceph changed_when: false diff --git a/roles/configure_libvirt/templates/libvirt_pool.xml.j2 b/roles/configure_libvirt/templates/libvirt_pool.xml.j2 index 88bef2d09..d94ee3b37 100644 --- a/roles/configure_libvirt/templates/libvirt_pool.xml.j2 +++ b/roles/configure_libvirt/templates/libvirt_pool.xml.j2 @@ -1,7 +1,7 @@ - {{ pool_name }} + {{ libvirt_pool_name }} - {{ rbd_pool_name }} + {{ libvirt_rbd_pool }} diff --git a/roles/configure_nic_irq_affinity/README.md b/roles/configure_nic_irq_affinity/README.md index 8e15c099a..f7d0e19ae 100644 --- a/roles/configure_nic_irq_affinity/README.md +++ b/roles/configure_nic_irq_affinity/README.md @@ -5,16 +5,23 @@ This is useful is you use macvlan driver for your containers or VMs ## Requirements -no requirement. +No requirement. ## Role Variables -- nics_affinity +| Variable | Required | Type | Comments | +|-------------------------|----------|----------- |--------------------------------------------------------------------| +| nics_affinity | no | Dict array | Array of dictionnaries, nic / affinity (e.g. "eth0": "3-4"). Affinity can be a single core, or a range seperate by *-*. Multiple values can be set separate by a coma. | ## Example Playbook ```yaml - hosts: cluster_machines + vars: + nics_affinity: + - "eth0": "3-4" + - "eth1": "9" + - "eth2": "7,10-13" roles: - { role: seapath_ansible.configure_nic_irq_affinity } ``` diff --git a/roles/configure_nic_irq_affinity/handlers/main.yml b/roles/configure_nic_irq_affinity/handlers/main.yml new file mode 100644 index 000000000..acc8c4067 --- /dev/null +++ b/roles/configure_nic_irq_affinity/handlers/main.yml @@ -0,0 +1,11 @@ +# Copyright (C) 2024 Savoir-faire Linux, Inc. +# SPDX-License-Identifier: Apache-2.0 + +--- + +- name: Enable and start NIC irq affinity service + systemd: + name: setup_nic_irq_affinity.service + enabled: yes + state: started + daemon_reload: yes diff --git a/roles/configure_nic_irq_affinity/meta/main.yml b/roles/configure_nic_irq_affinity/meta/main.yml index 7863c3ef8..103a88472 100644 --- a/roles/configure_nic_irq_affinity/meta/main.yml +++ b/roles/configure_nic_irq_affinity/meta/main.yml @@ -10,5 +10,10 @@ galaxy_info: - name: Debian versions: - all + - name: Yocto + versions: + - all + - name: CentOS + versions: + - all dependencies: [] - diff --git a/roles/configure_nic_irq_affinity/tasks/main.yml b/roles/configure_nic_irq_affinity/tasks/main.yml index a056c4fc8..3d0230c3a 100644 --- a/roles/configure_nic_irq_affinity/tasks/main.yml +++ b/roles/configure_nic_irq_affinity/tasks/main.yml @@ -10,23 +10,18 @@ src: setup_nic_irq_affinity.py dest: /etc/systemd/system/setup_nic_irq_affinity.py mode: 0755 - + - name: Copy NIC irq affinity service copy: src: setup_nic_irq_affinity.service dest: /etc/systemd/system/setup_nic_irq_affinity.service mode: 0644 - + - name: Copy NIC irq affinity environment file template: src: setup_nic_irq_affinity.j2 dest: /etc/default/setup_nic_irq_affinity mode: 0644 - - - name: Enable and start NIC irq affinity service - systemd: - name: setup_nic_irq_affinity.service - enabled: yes - state: started - daemon_reload: yes + when: nics_affinity is defined + notify: Enable and start NIC irq affinity service diff --git a/roles/conntrackd/README.md b/roles/conntrackd/README.md index 847ff82df..ddaac09b6 100644 --- a/roles/conntrackd/README.md +++ b/roles/conntrackd/README.md @@ -4,12 +4,16 @@ This role configure the conntrackd feature ## Requirements -no requirement. +No requirement. ## Role Variables - conntrackd_ignore_ip_list +| Variable | Required | Type | Comments | +|----------------------------|----------|--------|---------------------------------------------| +| conntrackd_ignore_ip_list | no | Bool | Enable contrackd if the variable is defined | + ## Example Playbook ```yaml diff --git a/roles/conntrackd/meta/main.yml b/roles/conntrackd/meta/main.yml index 3b8519776..777912876 100644 --- a/roles/conntrackd/meta/main.yml +++ b/roles/conntrackd/meta/main.yml @@ -10,5 +10,7 @@ galaxy_info: - name: Debian versions: - all + - name: CentOS + versions: + - all dependencies: [] - diff --git a/roles/deploy_cukinia/README.md b/roles/deploy_cukinia/README.md index 5abd0b530..f8e852858 100644 --- a/roles/deploy_cukinia/README.md +++ b/roles/deploy_cukinia/README.md @@ -4,11 +4,11 @@ This role deploys the cukinia utility ## Requirements -no requirement. +No requirement. ## Role Variables -no variable. +No variable. ## Example Playbook diff --git a/roles/deploy_cukinia/files/cukinia b/roles/deploy_cukinia/files/cukinia index 29ca6077f..de85359bb 160000 --- a/roles/deploy_cukinia/files/cukinia +++ b/roles/deploy_cukinia/files/cukinia @@ -1 +1 @@ -Subproject commit 29ca6077f71f2a49de80a4b4b38fb6aa50197c07 +Subproject commit de85359bbb8cd3f587d084b66d3d8f69a5971cde diff --git a/roles/deploy_cukinia_tests/README.md b/roles/deploy_cukinia_tests/README.md index 7dcbb2f77..54f92ff05 100644 --- a/roles/deploy_cukinia_tests/README.md +++ b/roles/deploy_cukinia_tests/README.md @@ -4,11 +4,11 @@ This role deploys the cukinia tests ## Requirements -no requirement. +No requirement. ## Role Variables -- filter (can be "none", "hosts", "observers" or "guests") +No variable. ## Example Playbook diff --git a/roles/deploy_cukinia_tests/cukinia-tests b/roles/deploy_cukinia_tests/cukinia-tests index 3cd9b6b7a..ac714c47e 160000 --- a/roles/deploy_cukinia_tests/cukinia-tests +++ b/roles/deploy_cukinia_tests/cukinia-tests @@ -1 +1 @@ -Subproject commit 3cd9b6b7ad0a1e1bf66789d867e7e42f597ee23c +Subproject commit ac714c47eeb220b443dd8ffd2d2dad435bbc5352 diff --git a/roles/deploy_python3_setup_ovs/README.md b/roles/deploy_python3_setup_ovs/README.md index d042c071c..1f08fe925 100644 --- a/roles/deploy_python3_setup_ovs/README.md +++ b/roles/deploy_python3_setup_ovs/README.md @@ -4,11 +4,11 @@ deploys python3-setup-ovs (seapath-config_ovs) ## Requirements -no requirement. +No requirement. ## Role Variables -no variable. +No variable. ## Example Playbook diff --git a/roles/deploy_python3_setup_ovs/meta/main.yml b/roles/deploy_python3_setup_ovs/meta/main.yml index be2c1a2d1..9a2e0f463 100644 --- a/roles/deploy_python3_setup_ovs/meta/main.yml +++ b/roles/deploy_python3_setup_ovs/meta/main.yml @@ -10,5 +10,7 @@ galaxy_info: - name: Debian versions: - all + - name: CentOS + versions: + - all dependencies: [] - diff --git a/roles/deploy_vm_manager/README.md b/roles/deploy_vm_manager/README.md index 983861d0d..2164aea10 100644 --- a/roles/deploy_vm_manager/README.md +++ b/roles/deploy_vm_manager/README.md @@ -4,11 +4,11 @@ This role deploys the vm_manager utility ## Requirements -no requirement. +No requirement. ## Role Variables -no variable. +No variable. ## Example Playbook diff --git a/roles/deploy_vm_manager/files/vm_manager b/roles/deploy_vm_manager/files/vm_manager index dc7d106c0..65c61c2cd 160000 --- a/roles/deploy_vm_manager/files/vm_manager +++ b/roles/deploy_vm_manager/files/vm_manager @@ -1 +1 @@ -Subproject commit dc7d106c011b0458982a2ba3c6b38d26f9046b16 +Subproject commit 65c61c2cdf513e4551ab41c436ebfa532a1b8c92 diff --git a/roles/deploy_vm_manager/meta/main.yml b/roles/deploy_vm_manager/meta/main.yml index 7b858f7fe..4759d000c 100644 --- a/roles/deploy_vm_manager/meta/main.yml +++ b/roles/deploy_vm_manager/meta/main.yml @@ -10,4 +10,7 @@ galaxy_info: - name: Debian versions: - all + - name: CentOS + versions: + - all dependencies: [] diff --git a/roles/deploy_vms_cluster/README.md b/roles/deploy_vms_cluster/README.md index 900f4f322..f05f0444e 100644 --- a/roles/deploy_vms_cluster/README.md +++ b/roles/deploy_vms_cluster/README.md @@ -1,21 +1,67 @@ # Deploy VMs on Cluster Seapath Role -This role deploys Guests in cluster mode +This role deploys a VM in a SEAPATH cluster. + +It use the `cluster_vm` Ansible plugin. + +Refer to the plugin documentation to know more about this plugin: https://galaxy.ansible.com/ui/repo/published/seapath/ansible/content/module/cluster_vm/ ## Requirements -no requirement. +No requirement. ## Role Variables -the role uses the "VMs" group in the inventory -and the following variables: -- qcow2tmpuploadfolder + +| Variable | Required | Type | Default | Comments | +|----------------------|----------|--------|---------|-----------------------------------------------------------------------------------------------------------------------------------------| +| qcow2tmpuploadfolder | no | String | "/tmp" | Path to a directory where the VM disk will be upload before being create. The VM disk file will be removed after being import into Ceph | +| item | yes | String | | Ansible inventory name of the VM. It will be the name of the VM. Only numbers and letters are allowed | +| vms_disks_directory | no | String | | Path in the Ansible machine to be prepend to the disk image path | +| disk_copy | no | Bool | true | Set true to copy the VM disk from the Ansible machine before creating the VM. | +| livemigration | no | String | | Linux user to use for VM livemigration. | + +Note the *item* variable must match an machine inside the inventory. This +machine can defined the following variable to change the role behavior: + +| *item* variables | Required | Type | Default | Comments | +|--------------------|----------|-------------|---------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| vm_disk | no | String | vms_disks_directory + item + ".qcow2" | Path to the VM disk in `qcow2` format on the the Ansible machine | +| live_migration | no | Bool | false | Set to true to enable livemigration supporting for this VM | +| migrate_to_timeout | no | Int | | Time given to a guest to live migrate (in seconds) | +| migration_downtime | no | Int | | Allowed downtime when live migrating (in milliseconds) | +| priority | no | Int | | Priority of resource in pacemaker | +| enable | no | Bool | true | Enable and start the VM after creating it | +| force | no | Bool | false | Replace the VM if a VM with the same name is already present | +| pinned_host | no | String | | Pin the VM on the given host. Fail if not possible | +| preferred_host | no | String | | Deploy the VM on the given host in priority if possible | +| crm_config_cmd | no | String list | | List of `crm config` to run when enabling this guest | +| xml_path | no | String | vms_disks_directory + item + ".qcow2" | Path in the Ansible machine of the VM libvirt XML configuration | +| vm_template | no | String | | Path in the Ansible machine of the VM libvirt XML configuration template which will be used to generate the VM configuration. All *item* Ansible variable will accessible in the template using the *vm* variable | +| colocated_vms | no | String list | | VM list to be be colocated with the new VM | +| strong_colocation | no | Bool | false | Set to true if we want the colocated_vms to be a strong colocation constraint. In this case VM will not be launch if the constraint is not fulfill | + + ## Example Playbook ```yaml -- hosts: cluster_machines + +- name: Deploy myVM on the cluster + hosts: "{{ groups.hypervisors[0] }}" + vars: + item: "myVM" + vms_disks_directory: my_VM_Directory roles: - - { role: seapath_ansible.deploy_vms_cluster } + - seapath_ansible.deploy_vms_cluster + +- name: Deploy all VMs on the cluster + hosts: "{{ groups.hypervisors[0] }}" + gather_facts: false + become: true + tasks: + - name: Deploy VMs on Cluster Role + with_items: "{{ groups['VMs'] }}" + include_role: + name: seapath_ansible.deploy_vms_cluster ``` diff --git a/roles/deploy_vms_cluster/defaults/main.yml b/roles/deploy_vms_cluster/defaults/main.yml new file mode 100644 index 000000000..01e890c4c --- /dev/null +++ b/roles/deploy_vms_cluster/defaults/main.yml @@ -0,0 +1,8 @@ +# Copyright (C) 2024 Savoir-faire Linux, Inc. +# SPDX-License-Identifier: Apache-2.0 + +--- + +disk_copy: true +qcow2tmpuploadfolder: "/tmp" +vms_disks_directory: "" diff --git a/roles/deploy_vms_cluster/tasks/main.yml b/roles/deploy_vms_cluster/tasks/main.yml index 5d25ab5f7..fce3edb48 100644 --- a/roles/deploy_vms_cluster/tasks/main.yml +++ b/roles/deploy_vms_cluster/tasks/main.yml @@ -27,7 +27,7 @@ dest: "{{ vm_file_dest }}" vars: ansible_remote_tmp: "{{ qcow2tmpuploadfolder | default(omit) }}" - when: disk_copy | default(true) | bool + when: disk_copy | bool - name: "Create {{ item }}" cluster_vm: name: "{{ item }}" @@ -61,8 +61,8 @@ - hostvars[item].wait_for_connection is defined - hostvars[item].wait_for_connection vars: - vm_file: "{{ hostvars[item].vm_disk | default( (vms_disks_directory|default('')) ~ '/' ~ item ~ '.qcow2') }}" - vm_file_dest: "{{ qcow2tmpuploadfolder | default('/tmp') + '/os.qcow2' }}" + vm_file: "{{ hostvars[item].vm_disk | default( vms_disks_directory ~ '/' ~ item ~ '.qcow2') }}" + vm_file_dest: "{{ qcow2tmpuploadfolder + '/os.qcow2' }}" when: presencevm.status == "Undefined" or (hostvars[item].force is defined and hostvars[item].force) diff --git a/roles/update/README.md b/roles/update/README.md index 75d8f1721..7cb077d04 100644 --- a/roles/update/README.md +++ b/roles/update/README.md @@ -10,9 +10,9 @@ No requirement. ## Role Variables -| Variable | Required | Default | Comments | -|-------------------------|----------|-----------|--------------------------------------------------| -| swu_image | yes | swu_image | Path of the swupdate file on the Ansible machine | +| Variable | Required | Type | Default | Comments | +|-------------------------|----------|--------|-----------|--------------------------------------------------| +| swu_image | yes | String | swu_image | Path of the swupdate file on the Ansible machine | ## Dependencies