diff --git a/snap-overlay/bin/set-default-config b/snap-overlay/bin/set-default-config new file mode 100755 index 0000000..26fd08d --- /dev/null +++ b/snap-overlay/bin/set-default-config @@ -0,0 +1,51 @@ +#!/bin/bash + +set -ex + +# Initialize Config +# TODO: put this in a nice yaml format, and parse it. + +# General snap-wide settings +snapctl set \ + config.clustered=false \ + config.post-setup=true \ + ; + +# Networking related settings. +snapctl set \ + config.network.dns=1.1.1.1 \ + config.network.ext-gateway=10.20.20.1 \ + config.network.control-ip=10.20.20.1 \ + config.network.compute-ip=10.20.20.1 \ + config.network.ext-cidr=10.20.20.1/24 \ + config.network.security-rules=true \ + config.network.dashboard-allowed-hosts="*" \ + ; + +# Passwords, certs, etc. +snapctl set \ + config.credentials.os-password=keystone \ + config.credentials.key-pair=id_microstack \ + config.credentials.nova-password=nova \ + config.credentials.neutron-password=neutron \ + config.credentials.placement-password=placement \ + config.credentials.glance-password=glance \ + ; + +# Host optimizations and fixes. +snapctl set \ + config.host.ip-forwarding=true \ + config.host.check-qemu=true \ + ; + +# Enable or disable groups of services. +snapctl set \ + config.services.control-plane=true \ + config.services.hypervisor=true \ + ; + +# Clustering roles +snapctl set \ + cluster.role=control \ + cluster.password=null \ + ; diff --git a/snap/hooks/install b/snap/hooks/install index af39678..9d0bc94 100755 --- a/snap/hooks/install +++ b/snap/hooks/install @@ -1,53 +1,8 @@ #!/bin/bash set -ex -# Initialize Config -# TODO: put this in a nice yaml format, and parse it. - -# General snap-wide settings -snapctl set \ - config.clustered=false \ - config.post-setup=true \ - ; - -# Networking related settings. -snapctl set \ - config.network.dns=1.1.1.1 \ - config.network.ext-gateway=10.20.20.1 \ - config.network.control-ip=10.20.20.1 \ - config.network.compute-ip=10.20.20.1 \ - config.network.ext-cidr=10.20.20.1/24 \ - config.network.security-rules=true \ - config.network.dashboard-allowed-hosts="*" \ - ; - -# Passwords, certs, etc. -snapctl set \ - config.credentials.os-password=keystone \ - config.credentials.key-pair=id_microstack \ - config.credentials.nova-password=nova \ - config.credentials.neutron-password=neutron \ - config.credentials.placement-password=placement \ - config.credentials.glance-password=glance \ - ; - -# Host optimizations and fixes. -snapctl set \ - config.host.ip-forwarding=true \ - config.host.check-qemu=true \ - ; - -# Enable or disable groups of services. -snapctl set \ - config.services.control-plane=true \ - config.services.hypervisor=true \ - ; - -# Clustering roles -snapctl set \ - cluster.role=control \ - cluster.password=null \ - ; +# Initialize config +set-default-config # MySQL snapshot for speedy install # snapshot is a mysql data dir with diff --git a/snap/hooks/post-refresh b/snap/hooks/post-refresh new file mode 100755 index 0000000..6433240 --- /dev/null +++ b/snap/hooks/post-refresh @@ -0,0 +1,19 @@ +#!/bin/bash +set -ex + +if [ -z "$(snapctl get config)" ]; then + # [2019-11-15] Handle build 171 (beta) -> 182 + + # We are upgrading from a version of the snap from before we put all + # config values under a config tree. Set the default values now (the + # old values were not documented, and we assume that they were not + # set). + set-default-config + + # Make a place for our horizon config overrides to live. We piggy + # back on the above check, because the changes were made + # concurrently. + mkdir -p ${SNAP_COMMON}/etc/horizon/local_settings.d +fi + +snap-openstack setup # Write any template changes.