From e465e20f521ab9099742de42c57e628e0bdcc2f4 Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 15 May 2025 18:19:01 -0600 Subject: [PATCH] Removing arch variable to use variable directly from the inventory Signed-off-by: Fernando --- roles/maas/tasks/add_machines.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/roles/maas/tasks/add_machines.yml b/roles/maas/tasks/add_machines.yml index 3b2bc60..7fc1bfb 100644 --- a/roles/maas/tasks/add_machines.yml +++ b/roles/maas/tasks/add_machines.yml @@ -1,7 +1,5 @@ --- - name: Add all machines from inventory to MAAS - vars: - arch: "amd64" # Change if needed when: inventory_hostname in groups['maas_region_rack_server'] tags: add_machines block: @@ -17,7 +15,8 @@ vars: hostname: "{{ item.split('.')[0] }}" mac_address: "{{ hostvars[item]['mac'] }}" - when: hostname not in existing_hostnames and mac_address is defined + arch: "{{ hostvars[item]['arch'] }}" + when: hostname not in existing_hostnames and mac_address is defined and arch is defined loop: "{{ groups['testnodes'] }}" command: "maas {{ maas_admin_username }} machines create architecture={{ arch }} mac_addresses={{ mac_address }} hostname={{ item }} power_type=manual deployed=true" -- 2.39.5