Browse Source

Remove cloud-init after first run by default

Sebastian Lohff 2 years ago
parent
commit
158c71c1cc
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      genconfdrv/genconfdrv.py

+ 5
- 1
genconfdrv/genconfdrv.py View File

@@ -269,6 +269,8 @@ def main():
269 269
     parser.add_argument("-u", "--disable-upgrades", action="store_true", default=False)
270 270
     parser.add_argument("-v", "--verbose", action="store_true", default=False)
271 271
     parser.add_argument("--no-debian-cleanup", "--ndc", action="store_true", default=False)
272
+    parser.add_argument("--no-remove-cloud-init", action="store_true", default=False,
273
+                        help="Do not purge cloud-init from system after execution")
272 274
     parser.add_argument("--set-root-password", "--srp", default=None)
273 275
     parser.add_argument("-a", "--add-user", default=[], nargs="+",
274 276
                         help="Add users, format is username:key?:sudo?:gecos?:password?, "
@@ -308,7 +310,6 @@ def main():
308 310
                                "rm /etc/apt/sources.list.d/*", True)
309 311
             cfgdrv.add_command("sed -rni '/^([^#]|## template)/p' "
310 312
                                "/etc/resolv.conf /etc/cloud/templates/resolv.conf.tmpl", True)
311
-
312 313
         if args.set_root_password:
313 314
             cfgdrv.set_password("root", args.set_root_password)
314 315
 
@@ -340,6 +341,9 @@ def main():
340 341
                     password = user[4]
341 342
                 cfgdrv.add_user(user[0], keys, sudo=sudo, gecos=gecos, password=password)
342 343
 
344
+        if not args.no_remove_cloud_init:
345
+            cfgdrv.add_command("apt remove -y cloud-init")
346
+
343 347
         if args.output:
344 348
             cfgdrv.write_drive(args.output, args.format)
345 349
     finally:

Loading…
Cancel
Save