I would like to use different preseeds-scripts based on the MAAS zone. But I think this isn't possible at the moment, maybe there is another solution how to use different preseeds-scripts based on tags or something similar?

The documentation didn't show any example or information if it's possible.

Thanks for your help!

share|improve this question
up vote 1 down vote accepted

Because the generic and preseed_master are generated automatically by the template engine Tempita we could access the objects from django / python and decide which parts of a preseed-script is called.

I'm for example created some zones (production, staging) and use different mirrors for the resource that is required. I've modified the generic file to add an extra definition:

{{def example}}
# set repository based on zone name
#·{{node.zone}}
{{if node.zone.name in {'staging',} }}
d-i apt-setup/local0/repository string deb https://repo.example.com/ubuntu staging/
d-i apt-setup/local0/comment string staging repository
d-i apt-setup/local0/key sting http://repo.example.com/repo.key
{{endif}}
{{if node.zone.name in {'production',} }}
d-i apt-setup/local0/repository string deb https://repo.example.com/ubuntu production/
d-i apt-setup/local0/comment string production repository
d-i apt-setup/local0/key sting http://repo.example.com/repo.key
{{endif}}
d-i apt-setup/local1/repository string deb https://repo.example.com/ubuntu common/
d-i apt-setup/local1/comment string common reposiotry
d-i apt-setup/local1/key sting http://repo.example.com/repo.key
d-i pkgsel/include string git jenkins-slave jenkins-scripts ntp
{{enddef}}

This definition could easily called in the preseed_master file via:

{{self.example}}

You could access all node information with the object node. All object / module details could be checked in the source code on /usr/lib/python2.7/dist-packages/maasserver/models/node.py

share|improve this answer

For a preseed based on tags, you can do:

{{if 'bigDisk' in (node.tag_names())}}
  ...
{{elif 'smallDisk' in (node.tag_names())}}
  ...
{{else}}
  ...
{{endif}}

If your 'preseed' part, in wich you use this, is inherited then you can not use the {{inherit "File"}}. At this moment.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.