m346/KN03/x_res/cloud-init-web_VORLAGE.yaml

48 lines
1.3 KiB
YAML
Raw Normal View History

2023-09-02 15:23:30 +02:00
#cloud-config
users:
- name: ubuntu
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
home: /home/ubuntu
shell: /bin/bash
2023-09-09 16:09:53 +02:00
ssh_authorized_keys: # Nächste Zeile ergänzen mit dem persönlichen Public-Key und einem sinnvollen Name (Abstand dazwischen nicht vergessen)
- ssh-rsa <Public-Key> <Random-Benutzername>
2023-09-02 15:23:30 +02:00
ssh_pwauth: false
disable_root: false
package_update: true
packages:
2023-09-09 16:28:32 +02:00
- <Wert eingeben>
2023-09-02 15:23:30 +02:00
- curl
- wget
- php
- libapache2-mod-php
- php-mysqli
- adminer
write_files:
- content: |
<?php phpinfo(); ?>
path: /var/www/html/info.php
permissions: '0644'
- content: |
<?php
$servername = "172.31.28.189";
$username = "admin";
$password = "password";
$dbname = "mysql";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "select Host, User from mysql.user;";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()){
echo($row["Host"] . " / " . $row["User"] . "<br />");
}
?>
path: /var/www/html/db.php
permissions: '0644'
runcmd:
2023-09-09 16:52:36 +02:00
- sudo a2enconf <Wert eingeben>
2023-09-02 15:23:30 +02:00
- sudo systemctl restart apache2