canonical / maas-ansible-playbook

An Ansible playbook for installing and configuring MAAS
Apache License 2.0
44 stars 34 forks source link

maas_secret_file undefined #111

Closed ben-ihelputech closed 1 year ago

ben-ihelputech commented 1 year ago

Where:

Installation

Version

snap, maas 3.3/stable

Environment

on lxc host: lxc launch ubuntu:22.04 maas-test

ssh-import-id-gh ben-ihelputech
# dpkg --print-architecture
amd64

Inventory.yaml

---
all:
  children:
    maas_postgres:
      children:
        maas_postgres_primary:
          hosts:
            maas-postgres-primary:
              ansible_host: 10.30.102.8
              ansible_user: root
        maas_postgres_secondary:
    maas_proxy:
    maas_region_controller:
      hosts:
        maas-region-controller-01:
          ansible_host: 10.30.102.8
          ansible_user: root
    maas_rack_controller:
      hosts:
        maas-rack-controller-01:
          ansible_host: 10.30.102.8
          ansible_user: root

Command

ansible-playbook -i inventory.yaml --extra-vars="maas_version=3.3 maas_postgres_password=MyPassword maas_installation_type=snap maas_url=http://x.x.x.x:5240/MAAS" ./site.yaml

Error

TASK [maas_rack_controller : Initialise MAAS Rack Controller]
fatal: [maas-rack-controller-01]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'maas_rack_secret' is undefined. 'maas_rack_secret' is undefined\n\nThe error appears to be in '/Users/ben/Nextcloud/Documents/Ansible/maas-ansible-playbook/roles/maas_rack_controller/tasks/install_maas.yaml': line 34, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Initialise MAAS Rack Controller\n  ^ here\n"}

Description

I'm trying to install maas with the playbook on a fresh VM, but I keep running on this error. Upon further inspection, it seems like under group_vars/all, maas_secret_file on line 74 is defined by /var/snap/maas/common/maas/secret. Well, the problem is when the rack controller goes to initialize on snap 3.3, this nothing exists in the directory. ls /var/snap/maas/common/maas/ Does this file need to be manually defined by an environment variable or is this a bug?

ElineMaaikedeWeerd commented 1 year ago

Hi @ben-ihelputech could you tell me what version of the playbooks you are using? You shouldn't need to manually define it.

ben-ihelputech commented 1 year ago

@ElineMaaikedeWeerd I just cloned the main branch yesterday

Edit: I see that a bunch of changes were merged about the time I opened the PR. I'll pull the main again and retest on a fresh VM.

ben-ihelputech commented 1 year ago

Something must have changed to resolve this issue. I recloned the repo this morning into a fresh directory on my laptop. I setup the hosts.yaml with the new lxd container and it seemed to work. 🤷‍♂️ I just used a single host same as last time and was able to get to the login page. I'm going to try and set it up in a mixed arm/amd environment with HA so we'll see how that goes.