Update infrastructure org
This commit is contained in:
parent
3550696f36
commit
338c30ea95
1 changed files with 802 additions and 797 deletions
|
@ -3,18 +3,40 @@
|
||||||
|
|
||||||
#+begin_src python :noweb "yes"
|
#+begin_src python :noweb "yes"
|
||||||
import os
|
import os
|
||||||
|
from collections import OrderedDict
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
cloudinit_data = {
|
def represent_ordereddict(dumper, data):
|
||||||
}
|
return dumper.represent_mapping('tag:yaml.org,2002:map', data.items())
|
||||||
|
|
||||||
|
yaml.add_representer(OrderedDict, represent_ordereddict)
|
||||||
|
|
||||||
|
# Define the order of keys
|
||||||
|
key_order = [
|
||||||
|
"local",
|
||||||
|
"keyboard",
|
||||||
|
"timezone",
|
||||||
|
"groups",
|
||||||
|
"users",
|
||||||
|
"packages",
|
||||||
|
"package_update",
|
||||||
|
"package_upgrade"
|
||||||
|
]
|
||||||
|
|
||||||
|
# Initialize OrderedDict with the defined keys
|
||||||
|
cloudinit_data = OrderedDict((key, None) for key in key_order)
|
||||||
|
|
||||||
<<local-settings>>
|
<<local-settings>>
|
||||||
<<timezone-setting>>
|
<<timezone-setting>>
|
||||||
<<groups-creation>>
|
<<groups-creation>>
|
||||||
<<user-creation-configuration>>
|
<<user-creation-configuration>>
|
||||||
|
<<package-install>>
|
||||||
|
|
||||||
|
# Remove any keys with None values
|
||||||
|
cloudinit_data = OrderedDict((k, v) for k, v in cloudinit_data.items() if v is not None)
|
||||||
|
|
||||||
with open("cloudinit1.yaml", 'w') as file:
|
with open("cloudinit1.yaml", 'w') as file:
|
||||||
file.write("#cloud-init\n")
|
file.write("#cloud-config\n")
|
||||||
yaml.dump(cloudinit_data, file, default_flow_style=False)
|
yaml.dump(cloudinit_data, file, default_flow_style=False)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
@ -90,29 +112,12 @@ Nginx and a regular user for administration.
|
||||||
|
|
||||||
Install necessary packages.
|
Install necessary packages.
|
||||||
|
|
||||||
#+BEGIN_SRC yaml
|
#+name: package-install
|
||||||
packages:
|
#+begin_src python :results none
|
||||||
- detachtty
|
cloudinit_data["packages"] = ["detachtty", "fail2ban", "ufw", "unattended-upgrades", "sbcl", "mosh", "tmux", "git", "nginx", "certbot", "python3-certbot-nginx", "build-essential", "libzstd-dev", "libsqlite3-dev", "sqlite3", "curl", "wget"]
|
||||||
- fail2ban
|
cloudinit_data["package_update"] = True
|
||||||
- ufw
|
cloudinit_data["package_upgrade"] = True
|
||||||
- unattended-upgrades
|
#+end_src
|
||||||
- sbcl
|
|
||||||
- mosh
|
|
||||||
- tmux
|
|
||||||
- git
|
|
||||||
- nginx
|
|
||||||
- certbot
|
|
||||||
- python3-certbot-nginx
|
|
||||||
- build-essential
|
|
||||||
- libzstd-dev
|
|
||||||
- libsqlite3-dev
|
|
||||||
- sqlite3
|
|
||||||
- curl
|
|
||||||
- wget
|
|
||||||
|
|
||||||
package_update: true
|
|
||||||
package_upgrade: true
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** File Writing
|
** File Writing
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue