diff --git a/ansible/k8s-master-playbook.yml b/ansible/k8s-master-playbook.yml new file mode 100644 index 0000000..b69b2ef --- /dev/null +++ b/ansible/k8s-master-playbook.yml @@ -0,0 +1,145 @@ +--- +- hosts: k8s_master + become: true + tasks: + - name: Install packages that allow apt to be used over HTTPS + apt: + name: "{{ packages }}" + state: present + update_cache: yes + vars: + packages: + - apt-transport-https + - ca-certificates + - curl + - gnupg-agent + - software-properties-common + + - name: Add an apt signing key for Docker + apt_key: + url: https://download.docker.com/linux/ubuntu/gpg + state: present + + - name: Add apt repository for stable version + apt_repository: + repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable + state: present + + - name: Install docker and its dependecies + apt: + name: "{{ packages }}" + state: present + update_cache: yes + vars: + packages: + - docker-ce + - docker-ce-cli + - containerd.io + notify: + - docker status + + - name: Add ubuntu user to docker group + user: + name: ubuntu + group: docker + + - name: Remove swapfile from /etc/fstab + mount: + name: "{{ item }}" + fstype: swap + state: absent + with_items: + - swap + - none + + - name: Disable swap + command: swapoff -a + when: ansible_swaptotal_mb > 0 + + - name: Add Kubernetes apt key. + apt_key: + url: https://packages.cloud.google.com/apt/doc/apt-key.gpg + state: present + register: add_repository_key + #ignore_errors: "{{ kubernetes_apt_ignore_key_error }}" + + - name: Add Kubernetes repository. + # xenial repo is used for all debian derivates at this time + apt_repository: + repo: "deb http://apt.kubernetes.io/ kubernetes-xenial main" + state: present + update_cache: true + +# - name: Add an apt signing key for Kubernetes +# apt_key: +# url: https://packages.cloud.google.com/apt/doc/apt-key.gpg +# state: present +# +# - name: Adding apt repository for Kubernetes +# apt_repository: +# repo: deb https://apt.kubernetes.io/ kubernetes-focal main +# state: present +# filename: kubernetes.list + + - name: Install Kubernetes binaries + apt: + name: "{{ packages }}" + state: present + update_cache: yes + vars: + packages: + - kubelet + - kubeadm + - kubectl + + - name: Configure node ip + lineinfile: + path: /etc/default/kubelet + line: KUBELET_EXTRA_ARGS=--node-ip={{ node_ip }} + create: yes + + - name: Restart kubelet + service: + name: kubelet + daemon_reload: yes + state: restarted + + - name: Initialize the Kubernetes cluster using kubeadm + command: kubeadm init --apiserver-advertise-address={{ node_ip }} --apiserver-cert-extra-sans={{ node_ip }} --node-name {{ vm_hostname }} --pod-network-cidr=192.168.0.0/16 + + - name: Setup kubeconfig for ubuntu user + command: "{{ item }}" + with_items: + - mkdir -p /home/ubuntu/.kube + - cp -i /etc/kubernetes/admin.conf /home/ubuntu/.kube/config + - chown ubuntu:ubuntu /home/ubuntu/.kube/config + +# - name: Install calico pod network +# become: false +# command: kubectl create -f https://docs.projectcalico.org/v3.4/getting-started/kubernetes/installation/hosted/calico.yaml +# + - name: Install the Tigera Calico operator and custom resource definitions. + become: false + command: kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml + + - name: Install Calico by creating the necessary custom resource. + become: false + command: kubectl create -f https://docs.projectcalico.org/manifests/custom-resources.yaml + + - name: Remove the taints on the master so that you can schedule pods on it. + become: false + command: kubectl taint nodes --all node-role.kubernetes.io/master- + + + - name: Generate join command + command: kubeadm token create --print-join-command + register: join_command + + - name: Copy join command to local file + local_action: copy content="{{ join_command.stdout_lines[0] }}" dest="./join-command" + + handlers: + - name: docker status + service: name=docker state=started + + diff --git a/ansible/k8s-slave-playbook.yml b/ansible/k8s-slave-playbook.yml new file mode 100644 index 0000000..43674bb --- /dev/null +++ b/ansible/k8s-slave-playbook.yml @@ -0,0 +1,101 @@ +--- +- hosts: k8s_slaves + become: true + tasks: + - name: Install packages that allow apt to be used over HTTPS + apt: + name: "{{ packages }}" + state: present + update_cache: yes + vars: + packages: + - apt-transport-https + - ca-certificates + - curl + - gnupg-agent + - software-properties-common + + - name: Add an apt signing key for Docker + apt_key: + url: https://download.docker.com/linux/ubuntu/gpg + state: present + + - name: Add apt repository for stable version + apt_repository: + repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable + state: present + + - name: Install docker and its dependecies + apt: + name: "{{ packages }}" + state: present + update_cache: yes + vars: + packages: + - docker-ce + - docker-ce-cli + - containerd.io + notify: + - docker status + + - name: Add vagrant user to docker group + user: + name: vagrant + group: docker + + - name: Remove swapfile from /etc/fstab + mount: + name: "{{ item }}" + fstype: swap + state: absent + with_items: + - swap + - none + + - name: Disable swap + command: swapoff -a + when: ansible_swaptotal_mb > 0 + + - name: Add an apt signing key for Kubernetes + apt_key: + url: https://packages.cloud.google.com/apt/doc/apt-key.gpg + state: present + + - name: Adding apt repository for Kubernetes + apt_repository: + repo: deb https://apt.kubernetes.io/ kubernetes-xenial main + state: present + filename: kubernetes.list + + - name: Install Kubernetes binaries + apt: + name: "{{ packages }}" + state: present + update_cache: yes + vars: + packages: + - kubelet + - kubeadm + - kubectl + + - name: Configure node ip + lineinfile: + create: true + path: /etc/default/kubelet + line: KUBELET_EXTRA_ARGS=--node-ip={{ node_ip }} + + - name: Restart kubelet + service: + name: kubelet + daemon_reload: yes + state: restarted + + - name: Copy the join command to server location + copy: src=join-command dest=/tmp/join-command.sh mode=0777 + + - name: Join the node to cluster + command: sh /tmp/join-command.sh + + handlers: + - name: docker status + service: name=docker state=started diff --git a/config/cloud_init.yml b/config/cloud_init.yml index 71864bf..e96ff9d 100644 --- a/config/cloud_init.yml +++ b/config/cloud_init.yml @@ -4,17 +4,22 @@ # https://cloudinit.readthedocs.io/en/latest/topics/examples.html bootcmd: - echo 192.168.0.1 gw.homedns.xyz >> /etc/hosts +hostname: ${vm_hostname} +package_update: true +package_upgrade: true +packages: ['qemu-guest-agent'] runcmd: - [ ls, -l, / ] - [ sh, -xc, "echo $(date) ': hello world!'" ] + - [ systemctl, daemon-reload ] + - [ systemctl, enable, qemu-guest-agent.service ] + - [ systemctl, start, --no-block, qemu-guest-agent.service ] ssh_pwauth: true disable_root: false chpasswd: list: | root:password expire: false -package_update: true -packages: ['qemu-guest-agent'] users: - name: ubuntu sudo: ALL=(ALL) NOPASSWD:ALL diff --git a/inventory.ini b/inventory.ini new file mode 100644 index 0000000..fa37334 --- /dev/null +++ b/inventory.ini @@ -0,0 +1,10 @@ +[k8s_master] +192.168.20.118 node_ip=192.168.20.118 vm_hostname=k8smaster +[k8s_master:vars] +ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand="ssh -W %h:%p -q hqt"' +[k8s_slaves:vars] +ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand="ssh -W %h:%p -q hqt"' +[k8s_slaves] +192.168.20.119 node_ip=192.168.20.119 +192.168.20.123 node_ip=192.168.20.123 +192.168.20.122 node_ip=192.168.20.122 diff --git a/main.tf b/main.tf index 89fe410..caf5614 100644 --- a/main.tf +++ b/main.tf @@ -12,12 +12,26 @@ resource "libvirt_pool" "tf_pool" { resource "libvirt_volume" "ubuntu-qcow2" { name = "ubuntu-qcow2" pool = libvirt_pool.tf_pool.name - source = var.ubuntu_18_img_url + #source = var.ubuntu_18_img_url + source = var.ubuntu_20_img_url format = "qcow2" + #size = var.vm_disk_size # not allowed if source is specified } +# Create a 5GB root volume +#resource "libvirt_volume" "rootfs" { +# name = "rootfs" +# pool = libvirt_pool.tf_pool.name +# #base_volume_id = "..." +# size = "5120" +#} + + data "template_file" "user_data" { template = file("${path.module}/config/cloud_init.yml") + vars = { + vm_hostname = var.vm_hostname + } } data "template_file" "network_config" { @@ -33,16 +47,17 @@ resource "libvirt_cloudinit_disk" "commoninit" { resource "libvirt_domain" "domain-ubuntu" { qemu_agent = true - name = var.vm_hostname - memory = "512" - vcpu = 1 + name = var.vm_name + memory = "4096" + vcpu = 2 cloudinit = libvirt_cloudinit_disk.commoninit.id network_interface { - network_name = "host-bridge" - wait_for_lease = true - hostname = var.vm_hostname + #network_name = "host-bridge" + bridge = "br0" + #wait_for_lease = true + hostname = var.vm_name } console { @@ -80,17 +95,111 @@ resource "libvirt_domain" "domain-ubuntu" { #bastion_host = "my-jump-host." #bastion_user = "deploys" #bastion_private_key = file("~/.ssh/deploys") - timeout = "2m" + timeout = "4m" } } provisioner "local-exec" { command = < nginx.ini - echo "${libvirt_domain.domain-ubuntu.network_interface[0].addresses[0]}" >> nginx.ini - echo "[nginx:vars]" >> nginx.ini - echo "ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand=\"ssh -W %h:%p -q hqt\"'" >> nginx.ini - ansible-playbook -u ${var.ssh_username} --private-key ${var.ssh_private_key} -i nginx.ini ansible/playbook.yml + echo "[k8s_master]" > inventory.ini + echo "${libvirt_domain.domain-ubuntu.network_interface[0].addresses[0]} node_ip=${libvirt_domain.domain-ubuntu.network_interface[0].addresses[0]} vm_hostname=${var.vm_hostname}" >> inventory.ini + echo "[k8s_master:vars]" >> inventory.ini + echo "ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand=\"ssh -W %h:%p -q hqt\"'" >> inventory.ini + echo "[k8s_slaves:vars]" >> inventory.ini + echo "ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand=\"ssh -W %h:%p -q hqt\"'" >> inventory.ini + echo "[k8s_slaves]" >> inventory.ini + #ansible-playbook -u ${var.ssh_username} --private-key ${var.ssh_private_key} -i nginx.ini ansible/playbook.yml + ansible-playbook -u ${var.ssh_username} --private-key ${var.ssh_private_key} -i inventory.ini ansible/k8s-master-playbook.yml + EOT + } +} + +resource "libvirt_volume" "k8sslaves-qcow2" { + count = var.slaves + name = "k8sslaves-${count.index}.qcow2" + pool = libvirt_pool.tf_pool.name + #source = "${path.module}/sources/${var.distros[count.index]}.qcow2" + source = var.ubuntu_20_img_url + format = "qcow2" +} + +data "template_file" "slaves_user_data" { + count = var.slaves + template = file("${path.module}/config/cloud_init.yml") + vars = { + vm_hostname = "${var.vm_slave_hostname}${count.index}" + } +} + + +resource "libvirt_cloudinit_disk" "slaves_commoninit" { + count = var.slaves + name = "slaves-commoninit-${count.index}.iso" + user_data = data.template_file.slaves_user_data[count.index].rendered + network_config = data.template_file.network_config.rendered + pool = libvirt_pool.tf_pool.name +} + +resource "libvirt_domain" "domain-k8s-slave" { + count = var.slaves + qemu_agent = true + name = "${var.vm_slave_name}-${count.index}" + memory = "4096" + vcpu = 2 + + cloudinit = libvirt_cloudinit_disk.slaves_commoninit[count.index].id + + network_interface { + #network_name = "host-bridge" + bridge = "br0" + #wait_for_lease = true + hostname = "${var.vm_slave_name}-${count.index}" + #hostname = var.vm_slave_name + } + + console { + type = "pty" + target_port = "0" + target_type = "serial" + } + + console { + type = "pty" + target_type = "virtio" + target_port = "1" + } + + disk { + volume_id = element(libvirt_volume.k8sslaves-qcow2.*.id, count.index) + } + + graphics { + type = "spice" + listen_type = "address" + autoport = true + } + + provisioner "remote-exec" { + inline = [ + "echo 'Hello World'" + ] + + connection { + type = "ssh" + user = var.ssh_username + host = self.network_interface[0].addresses[0] + private_key = file(var.ssh_private_key) + #bastion_host = "my-jump-host." + #bastion_user = "deploys" + #bastion_private_key = file("~/.ssh/deploys") + timeout = "4m" + } + } + + provisioner "local-exec" { + command = <> inventory.ini + ansible-playbook -u ${var.ssh_username} --private-key ${var.ssh_private_key} -i inventory.ini ansible/k8s-slave-playbook.yml EOT } } diff --git a/nginx.ini b/nginx.ini new file mode 100644 index 0000000..a8fe1db --- /dev/null +++ b/nginx.ini @@ -0,0 +1,4 @@ +[nginx] +192.168.20.78 +[nginx:vars] +ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand="ssh -W %h:%p -q hqt"' diff --git a/terraform.tfstate b/terraform.tfstate index bda2371..8562455 100644 --- a/terraform.tfstate +++ b/terraform.tfstate @@ -1,15 +1,15 @@ { "version": 4, - "terraform_version": "0.15.3", - "serial": 45, + "terraform_version": "0.15.5", + "serial": 197, "lineage": "af915bb1-8f21-5cbd-1e34-2c8a151a91f9", "outputs": { "ip": { - "value": "192.168.20.73", + "value": "192.168.20.118", "type": "string" }, "url": { - "value": "http://192.168.20.73", + "value": "http://192.168.20.118", "type": "string" } }, @@ -33,6 +33,56 @@ } ] }, + { + "mode": "data", + "type": "template_file", + "name": "slaves_user_data", + "provider": "provider[\"registry.terraform.io/hashicorp/template\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "filename": null, + "id": "2c2d99cfa01ad9ebdb5df527d69ed1d69e0de6b04a32e94a1039211aa71b921d", + "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster0 \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: ${vm_hostname} \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "vars": { + "vm_hostname": "k8smaster0" + } + }, + "sensitive_attributes": [] + }, + { + "index_key": 1, + "schema_version": 0, + "attributes": { + "filename": null, + "id": "f65c283af5a9f71d5790b9446655a5dd3434e01a7300cf0877b8889cf6522899", + "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster1 \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: ${vm_hostname} \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "vars": { + "vm_hostname": "k8smaster1" + } + }, + "sensitive_attributes": [] + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "filename": null, + "id": "caea900b30d5fbc6e7bfa1134e60b0acb71bcc0634c4cf1396c7747249dc9ed1", + "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster2 \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: ${vm_hostname} \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "vars": { + "vm_hostname": "k8smaster2" + } + }, + "sensitive_attributes": [] + } + ] + }, { "mode": "data", "type": "template_file", @@ -43,10 +93,12 @@ "schema_version": 0, "attributes": { "filename": null, - "id": "1349ad532dd23c8b99a91bfaf16f2f0cbddc92c6780bf5cac2f5544adaf091a1", - "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\npackage_update: true\npackages: ['qemu-guest-agent']\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", - "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\npackage_update: true\npackages: ['qemu-guest-agent']\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", - "vars": null + "id": "52df8e80e4138614477d1609058fdd059f54c34b68a4869242ebd38b09a85258", + "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: ${vm_hostname} \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "vars": { + "vm_hostname": "k8smaster" + } }, "sensitive_attributes": [] } @@ -61,12 +113,12 @@ { "schema_version": 0, "attributes": { - "id": "/mnt/data1/libvirt_tf_volumes/commoninit.iso;60acffa2-a30b-dd14-e627-608200b09a37", + "id": "/mnt/data1/libvirt_tf_volumes/commoninit.iso;60b0949a-f28d-32dc-4bd4-96e4dba4d36b", "meta_data": "", "name": "commoninit.iso", "network_config": "version: 2\nethernets:\n ens3:\n dhcp4: true\n", "pool": "tf_pool", - "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\npackage_update: true\npackages: ['qemu-guest-agent']\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" + "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" }, "sensitive_attributes": [], "private": "bnVsbA==", @@ -80,17 +132,367 @@ }, { "mode": "managed", - "type": "libvirt_domain", - "name": "domain-ubuntu", + "type": "libvirt_cloudinit_disk", + "name": "slaves_commoninit", "provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]", "instances": [ { + "index_key": 0, + "schema_version": 0, + "attributes": { + "id": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-0.iso;60be234f-22a4-f58f-8b75-b36c059241f0", + "meta_data": "", + "name": "slaves-commoninit-0.iso", + "network_config": "version: 2\nethernets:\n ens3:\n dhcp4: true\n", + "pool": "tf_pool", + "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster0 \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_pool.tf_pool" + ] + }, + { + "index_key": 1, + "schema_version": 0, + "attributes": { + "id": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-1.iso;60be2350-b20f-ec85-5b34-e275d902fd1a", + "meta_data": "", + "name": "slaves-commoninit-1.iso", + "network_config": "version: 2\nethernets:\n ens3:\n dhcp4: true\n", + "pool": "tf_pool", + "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster1 \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_pool.tf_pool" + ] + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "id": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-2.iso;60be2350-04eb-26b2-214e-62e370f34143", + "meta_data": "", + "name": "slaves-commoninit-2.iso", + "network_config": "version: 2\nethernets:\n ens3:\n dhcp4: true\n", + "pool": "tf_pool", + "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster2 \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_pool.tf_pool" + ] + } + ] + }, + { + "mode": "managed", + "type": "libvirt_domain", + "name": "domain-k8s-slave", + "provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]", + "instances": [ + { + "index_key": 0, + "status": "tainted", "schema_version": 0, "attributes": { "arch": "x86_64", "autostart": false, "boot_device": [], - "cloudinit": "/mnt/data1/libvirt_tf_volumes/commoninit.iso;60acffa2-a30b-dd14-e627-608200b09a37", + "cloudinit": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-0.iso;60be234f-22a4-f58f-8b75-b36c059241f0", + "cmdline": null, + "console": [ + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "0", + "target_type": "serial", + "type": "pty" + }, + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "1", + "target_type": "virtio", + "type": "pty" + } + ], + "coreos_ignition": null, + "cpu": null, + "description": "", + "disk": [ + { + "block_device": "", + "file": "", + "scsi": false, + "url": "", + "volume_id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-0.qcow2", + "wwn": "" + } + ], + "emulator": "/usr/bin/qemu-system-x86_64", + "filesystem": [], + "firmware": "", + "fw_cfg_name": "opt/com.coreos/config", + "graphics": [ + { + "autoport": true, + "listen_address": "127.0.0.1", + "listen_type": "address", + "type": "spice" + } + ], + "id": "afef3fc7-a833-4b29-9edb-66bee99d03ff", + "initrd": "", + "kernel": "", + "machine": "pc", + "memory": 4096, + "metadata": null, + "name": "tf-k8s-slave-0", + "network_interface": [ + { + "addresses": [], + "bridge": "br0", + "hostname": "tf-k8s-slave-0", + "mac": "52:54:00:1A:BB:E2", + "macvtap": "", + "network_id": "", + "network_name": "", + "passthrough": "", + "vepa": "", + "wait_for_lease": false + } + ], + "nvram": [], + "qemu_agent": true, + "running": true, + "timeouts": null, + "vcpu": 2, + "video": [], + "xml": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_cloudinit_disk.slaves_commoninit", + "libvirt_pool.tf_pool", + "libvirt_volume.k8sslaves-qcow2" + ] + }, + { + "index_key": 1, + "status": "tainted", + "schema_version": 0, + "attributes": { + "arch": "x86_64", + "autostart": false, + "boot_device": [], + "cloudinit": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-1.iso;60be2350-b20f-ec85-5b34-e275d902fd1a", + "cmdline": null, + "console": [ + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "0", + "target_type": "serial", + "type": "pty" + }, + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "1", + "target_type": "virtio", + "type": "pty" + } + ], + "coreos_ignition": null, + "cpu": null, + "description": "", + "disk": [ + { + "block_device": "", + "file": "", + "scsi": false, + "url": "", + "volume_id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-1.qcow2", + "wwn": "" + } + ], + "emulator": "/usr/bin/qemu-system-x86_64", + "filesystem": [], + "firmware": "", + "fw_cfg_name": "opt/com.coreos/config", + "graphics": [ + { + "autoport": true, + "listen_address": "127.0.0.1", + "listen_type": "address", + "type": "spice" + } + ], + "id": "f7206ce1-0125-45f3-9f3c-7c265c5902bc", + "initrd": "", + "kernel": "", + "machine": "pc", + "memory": 4096, + "metadata": null, + "name": "tf-k8s-slave-1", + "network_interface": [ + { + "addresses": [], + "bridge": "br0", + "hostname": "tf-k8s-slave-1", + "mac": "52:54:00:A6:B4:44", + "macvtap": "", + "network_id": "", + "network_name": "", + "passthrough": "", + "vepa": "", + "wait_for_lease": false + } + ], + "nvram": [], + "qemu_agent": true, + "running": true, + "timeouts": null, + "vcpu": 2, + "video": [], + "xml": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_cloudinit_disk.slaves_commoninit", + "libvirt_pool.tf_pool", + "libvirt_volume.k8sslaves-qcow2" + ] + }, + { + "index_key": 2, + "status": "tainted", + "schema_version": 0, + "attributes": { + "arch": "x86_64", + "autostart": false, + "boot_device": [], + "cloudinit": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-2.iso;60be2350-04eb-26b2-214e-62e370f34143", + "cmdline": null, + "console": [ + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "0", + "target_type": "serial", + "type": "pty" + }, + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "1", + "target_type": "virtio", + "type": "pty" + } + ], + "coreos_ignition": null, + "cpu": null, + "description": "", + "disk": [ + { + "block_device": "", + "file": "", + "scsi": false, + "url": "", + "volume_id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-2.qcow2", + "wwn": "" + } + ], + "emulator": "/usr/bin/qemu-system-x86_64", + "filesystem": [], + "firmware": "", + "fw_cfg_name": "opt/com.coreos/config", + "graphics": [ + { + "autoport": true, + "listen_address": "127.0.0.1", + "listen_type": "address", + "type": "spice" + } + ], + "id": "2a63429a-b5d0-40df-b1e8-862196fb5cf7", + "initrd": "", + "kernel": "", + "machine": "pc", + "memory": 4096, + "metadata": null, + "name": "tf-k8s-slave-2", + "network_interface": [ + { + "addresses": [], + "bridge": "br0", + "hostname": "tf-k8s-slave-2", + "mac": "52:54:00:4E:AC:41", + "macvtap": "", + "network_id": "", + "network_name": "", + "passthrough": "", + "vepa": "", + "wait_for_lease": false + } + ], + "nvram": [], + "qemu_agent": true, + "running": true, + "timeouts": null, + "vcpu": 2, + "video": [], + "xml": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_cloudinit_disk.slaves_commoninit", + "libvirt_pool.tf_pool", + "libvirt_volume.k8sslaves-qcow2" + ] + } + ] + }, + { + "mode": "managed", + "type": "libvirt_domain", + "name": "domain-ubuntu", + "provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]", + "instances": [ + { + "status": "tainted", + "schema_version": 0, + "attributes": { + "arch": "x86_64", + "autostart": false, + "boot_device": [], + "cloudinit": "/mnt/data1/libvirt_tf_volumes/commoninit.iso;60b0949a-f28d-32dc-4bd4-96e4dba4d36b", "cmdline": null, "console": [ { @@ -135,35 +537,32 @@ "type": "spice" } ], - "id": "b271dfe1-d2ff-4b1c-9c78-f62379f66e23", + "id": "a2650d78-fd6c-4280-91f7-b6d9ee444436", "initrd": "", "kernel": "", "machine": "pc", - "memory": 512, + "memory": 4096, "metadata": null, - "name": "terraform-kvm-ansible", + "name": "tf-k8s-master", "network_interface": [ { - "addresses": [ - "192.168.20.73", - "fe80::5054:ff:fe0e:c4df" - ], + "addresses": [], "bridge": "br0", - "hostname": "terraform-kvm-ansible", - "mac": "52:54:00:0E:C4:DF", + "hostname": "tf-k8s-master", + "mac": "52:54:00:82:57:64", "macvtap": "", "network_id": "", "network_name": "", "passthrough": "", "vepa": "", - "wait_for_lease": true + "wait_for_lease": false } ], "nvram": [], "qemu_agent": true, "running": true, "timeouts": null, - "vcpu": 1, + "vcpu": 2, "video": [], "xml": [] }, @@ -171,6 +570,7 @@ "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==", "dependencies": [ "libvirt_cloudinit_disk.commoninit", + "libvirt_pool.tf_pool", "libvirt_volume.ubuntu-qcow2" ] } @@ -185,7 +585,7 @@ { "schema_version": 0, "attributes": { - "allocation": 220974116864, + "allocation": 219552047104, "available": null, "capacity": 1967792529408, "id": "40b537c5-c26e-49d3-9660-3bfe18eb0907", @@ -199,6 +599,77 @@ } ] }, + { + "mode": "managed", + "type": "libvirt_volume", + "name": "k8sslaves-qcow2", + "provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "base_volume_id": null, + "base_volume_name": null, + "base_volume_pool": null, + "format": "qcow2", + "id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-0.qcow2", + "name": "k8sslaves-0.qcow2", + "pool": "tf_pool", + "size": 21474836480, + "source": "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img", + "xml": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "libvirt_pool.tf_pool" + ] + }, + { + "index_key": 1, + "schema_version": 0, + "attributes": { + "base_volume_id": null, + "base_volume_name": null, + "base_volume_pool": null, + "format": "qcow2", + "id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-1.qcow2", + "name": "k8sslaves-1.qcow2", + "pool": "tf_pool", + "size": 21474836480, + "source": "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img", + "xml": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "libvirt_pool.tf_pool" + ] + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "base_volume_id": null, + "base_volume_name": null, + "base_volume_pool": null, + "format": "qcow2", + "id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-2.qcow2", + "name": "k8sslaves-2.qcow2", + "pool": "tf_pool", + "size": 21474836480, + "source": "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img", + "xml": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "libvirt_pool.tf_pool" + ] + } + ] + }, { "mode": "managed", "type": "libvirt_volume", @@ -215,8 +686,8 @@ "id": "/mnt/data1/libvirt_tf_volumes/ubuntu-qcow2", "name": "ubuntu-qcow2", "pool": "tf_pool", - "size": 2361393152, - "source": "http://cloud-images.ubuntu.com/releases/bionic/release-20191008/ubuntu-18.04-server-cloudimg-amd64.img", + "size": 21474836480, + "source": "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img", "xml": [] }, "sensitive_attributes": [], diff --git a/terraform.tfstate.backup b/terraform.tfstate.backup index 9a3c437..3085ee1 100644 --- a/terraform.tfstate.backup +++ b/terraform.tfstate.backup @@ -1,9 +1,18 @@ { "version": 4, - "terraform_version": "0.15.3", - "serial": 42, + "terraform_version": "0.15.5", + "serial": 182, "lineage": "af915bb1-8f21-5cbd-1e34-2c8a151a91f9", - "outputs": {}, + "outputs": { + "ip": { + "value": "192.168.20.118", + "type": "string" + }, + "url": { + "value": "http://192.168.20.118", + "type": "string" + } + }, "resources": [ { "mode": "data", @@ -24,6 +33,56 @@ } ] }, + { + "mode": "data", + "type": "template_file", + "name": "slaves_user_data", + "provider": "provider[\"registry.terraform.io/hashicorp/template\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "filename": null, + "id": "52df8e80e4138614477d1609058fdd059f54c34b68a4869242ebd38b09a85258", + "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: ${vm_hostname} \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "vars": { + "vm_hostname": "k8smaster" + } + }, + "sensitive_attributes": [] + }, + { + "index_key": 1, + "schema_version": 0, + "attributes": { + "filename": null, + "id": "52df8e80e4138614477d1609058fdd059f54c34b68a4869242ebd38b09a85258", + "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: ${vm_hostname} \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "vars": { + "vm_hostname": "k8smaster" + } + }, + "sensitive_attributes": [] + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "filename": null, + "id": "52df8e80e4138614477d1609058fdd059f54c34b68a4869242ebd38b09a85258", + "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: ${vm_hostname} \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "vars": { + "vm_hostname": "k8smaster" + } + }, + "sensitive_attributes": [] + } + ] + }, { "mode": "data", "type": "template_file", @@ -34,10 +93,12 @@ "schema_version": 0, "attributes": { "filename": null, - "id": "1349ad532dd23c8b99a91bfaf16f2f0cbddc92c6780bf5cac2f5544adaf091a1", - "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\npackage_update: true\npackages: ['qemu-guest-agent']\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", - "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\npackage_update: true\npackages: ['qemu-guest-agent']\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", - "vars": null + "id": "52df8e80e4138614477d1609058fdd059f54c34b68a4869242ebd38b09a85258", + "rendered": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "template": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: ${vm_hostname} \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n", + "vars": { + "vm_hostname": "k8smaster" + } }, "sensitive_attributes": [] } @@ -52,20 +113,377 @@ { "schema_version": 0, "attributes": { - "id": "/mnt/data1/libvirt_tf_volumes/commoninit.iso;60acffa2-a30b-dd14-e627-608200b09a37", + "id": "/mnt/data1/libvirt_tf_volumes/commoninit.iso;60b0949a-f28d-32dc-4bd4-96e4dba4d36b", "meta_data": "", "name": "commoninit.iso", "network_config": "version: 2\nethernets:\n ens3:\n dhcp4: true\n", "pool": "tf_pool", - "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\npackage_update: true\npackages: ['qemu-guest-agent']\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" + "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "data.template_file.user_data", + "libvirt_pool.tf_pool", + "data.template_file.network_config" + ] + } + ] + }, + { + "mode": "managed", + "type": "libvirt_cloudinit_disk", + "name": "slaves_commoninit", + "provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "id": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-0.iso;60b5f894-33ea-f5e1-7fd7-d1fc0babb409", + "meta_data": "", + "name": "slaves-commoninit-0.iso", + "network_config": "version: 2\nethernets:\n ens3:\n dhcp4: true\n", + "pool": "tf_pool", + "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" }, "sensitive_attributes": [], "private": "bnVsbA==", "dependencies": [ "data.template_file.network_config", - "data.template_file.user_data", + "data.template_file.slaves_user_data", "libvirt_pool.tf_pool" ] + }, + { + "index_key": 1, + "schema_version": 0, + "attributes": { + "id": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-1.iso;60b5f894-fea4-cbf9-616b-a6d4a6bf625e", + "meta_data": "", + "name": "slaves-commoninit-1.iso", + "network_config": "version: 2\nethernets:\n ens3:\n dhcp4: true\n", + "pool": "tf_pool", + "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_pool.tf_pool" + ] + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "id": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-2.iso;60b5f894-c547-5550-59d2-43a7993e2564", + "meta_data": "", + "name": "slaves-commoninit-2.iso", + "network_config": "version: 2\nethernets:\n ens3:\n dhcp4: true\n", + "pool": "tf_pool", + "user_data": "#cloud-config\n# vim: syntax=yaml\n# examples:\n# https://cloudinit.readthedocs.io/en/latest/topics/examples.html\nbootcmd:\n - echo 192.168.0.1 gw.homedns.xyz \u003e\u003e /etc/hosts\nhostname: k8smaster \npackage_update: true\npackage_upgrade: true\npackages: ['qemu-guest-agent']\nruncmd:\n - [ ls, -l, / ]\n - [ sh, -xc, \"echo $(date) ': hello world!'\" ]\n - [ systemctl, daemon-reload ]\n - [ systemctl, enable, qemu-guest-agent.service ] \n - [ systemctl, start, --no-block, qemu-guest-agent.service ]\nssh_pwauth: true\ndisable_root: false\nchpasswd:\n list: |\n root:password\n expire: false\nusers:\n - name: ubuntu\n sudo: ALL=(ALL) NOPASSWD:ALL\n groups: users, admin\n home: /home/ubuntu\n shell: /bin/bash\n lock_passwd: false\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtU8bRGqwt13HgTbL/YDj19ljVUsZPTGFfdLUA4k4dPrVuQR77c7pdMPW25j/NS5LbnkKhEEoMJB7qzcGBBKiMAA9J30jJxqXeV48VUKNxByTEQEqQ8FpnQICpvFueEyP/AX6/gLy77a1IldTWabNmplJqxBkksn1P1q8EIzXlXu0Xj1WGNxW/yF+Unp28qvqNuWlLyAwOfMcYUO1a7XUsD3/vcjNySqH6TlJAf8VDTNidcZXvyWJf2WjSK85NNJCLSVDdJ5/595PnjWxYnML8gyDo0qUAxhx3jMVT3sa5Wd/aonMYNpm2YwjZQuFPksotvkEk7ZIqE6ejBh+oX52uwoVDG38TfQRkpxp6psn+ZtSaa+/Jf9eqHGWRgwrgSKP56ezvILZxcOzBfXcszGBYRLUMJbMqYpRAO24SfrYrKM5DKs9yFQHkgybcho406DCluQ5MhqiO4UPc22cQ8fxTSdLxLBlPOpP0rkgh5zz54DHhhmKgGzBIWxKfN+M+5CE= tobias@hqt \nfinal_message: \"The system is finally up, after $UPTIME seconds\"\n" + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_pool.tf_pool" + ] + } + ] + }, + { + "mode": "managed", + "type": "libvirt_domain", + "name": "domain-k8s-slave", + "provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]", + "instances": [ + { + "index_key": 0, + "status": "tainted", + "schema_version": 0, + "attributes": { + "arch": "x86_64", + "autostart": false, + "boot_device": [], + "cloudinit": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-0.iso;60b5f894-33ea-f5e1-7fd7-d1fc0babb409", + "cmdline": null, + "console": [ + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "0", + "target_type": "serial", + "type": "pty" + }, + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "1", + "target_type": "virtio", + "type": "pty" + } + ], + "coreos_ignition": null, + "cpu": null, + "description": "", + "disk": [ + { + "block_device": "", + "file": "", + "scsi": false, + "url": "", + "volume_id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-0.qcow2", + "wwn": "" + } + ], + "emulator": "/usr/bin/qemu-system-x86_64", + "filesystem": [], + "firmware": "", + "fw_cfg_name": "opt/com.coreos/config", + "graphics": [ + { + "autoport": true, + "listen_address": "127.0.0.1", + "listen_type": "address", + "type": "spice" + } + ], + "id": "36599e93-c019-4f29-85eb-4a88dd8edf9c", + "initrd": "", + "kernel": "", + "machine": "pc", + "memory": 4096, + "metadata": null, + "name": "tf-k8s-slave-0", + "network_interface": [ + { + "addresses": [ + "192.168.20.122", + "fe80::5054:ff:fee2:36de" + ], + "bridge": "br0", + "hostname": "tf-k8s-slave-0", + "mac": "52:54:00:E2:36:DE", + "macvtap": "", + "network_id": "", + "network_name": "", + "passthrough": "", + "vepa": "", + "wait_for_lease": false + } + ], + "nvram": [], + "qemu_agent": true, + "running": true, + "timeouts": null, + "vcpu": 2, + "video": [], + "xml": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_cloudinit_disk.slaves_commoninit", + "libvirt_pool.tf_pool", + "libvirt_volume.k8sslaves-qcow2" + ] + }, + { + "index_key": 1, + "status": "tainted", + "schema_version": 0, + "attributes": { + "arch": "x86_64", + "autostart": false, + "boot_device": [], + "cloudinit": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-1.iso;60b5f894-fea4-cbf9-616b-a6d4a6bf625e", + "cmdline": null, + "console": [ + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "0", + "target_type": "serial", + "type": "pty" + }, + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "1", + "target_type": "virtio", + "type": "pty" + } + ], + "coreos_ignition": null, + "cpu": null, + "description": "", + "disk": [ + { + "block_device": "", + "file": "", + "scsi": false, + "url": "", + "volume_id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-1.qcow2", + "wwn": "" + } + ], + "emulator": "/usr/bin/qemu-system-x86_64", + "filesystem": [], + "firmware": "", + "fw_cfg_name": "opt/com.coreos/config", + "graphics": [ + { + "autoport": true, + "listen_address": "127.0.0.1", + "listen_type": "address", + "type": "spice" + } + ], + "id": "2adf40ab-f063-4539-b9ac-04a0c294e744", + "initrd": "", + "kernel": "", + "machine": "pc", + "memory": 4096, + "metadata": null, + "name": "tf-k8s-slave-1", + "network_interface": [ + { + "addresses": [ + "192.168.20.123", + "fe80::5054:ff:fe4a:f80f" + ], + "bridge": "br0", + "hostname": "tf-k8s-slave-1", + "mac": "52:54:00:4A:F8:0F", + "macvtap": "", + "network_id": "", + "network_name": "", + "passthrough": "", + "vepa": "", + "wait_for_lease": false + } + ], + "nvram": [], + "qemu_agent": true, + "running": true, + "timeouts": null, + "vcpu": 2, + "video": [], + "xml": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_cloudinit_disk.slaves_commoninit", + "libvirt_pool.tf_pool", + "libvirt_volume.k8sslaves-qcow2" + ] + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "arch": "x86_64", + "autostart": false, + "boot_device": [], + "cloudinit": "/mnt/data1/libvirt_tf_volumes/slaves-commoninit-2.iso;60b5f894-c547-5550-59d2-43a7993e2564", + "cmdline": [], + "console": [ + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "0", + "target_type": "serial", + "type": "pty" + }, + { + "source_host": "127.0.0.1", + "source_path": "", + "source_service": "0", + "target_port": "1", + "target_type": "virtio", + "type": "pty" + } + ], + "coreos_ignition": null, + "cpu": null, + "description": "", + "disk": [ + { + "block_device": "", + "file": "", + "scsi": false, + "url": "", + "volume_id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-2.qcow2", + "wwn": "" + } + ], + "emulator": "/usr/bin/qemu-system-x86_64", + "filesystem": [], + "firmware": "", + "fw_cfg_name": "opt/com.coreos/config", + "graphics": [ + { + "autoport": true, + "listen_address": "127.0.0.1", + "listen_type": "address", + "type": "spice" + } + ], + "id": "3d16268e-9006-4265-acca-a6f71c9de530", + "initrd": "", + "kernel": "", + "machine": "pc", + "memory": 4096, + "metadata": null, + "name": "tf-k8s-slave-2", + "network_interface": [ + { + "addresses": [ + "192.168.20.119", + "fe80::5054:ff:fee2:5648" + ], + "bridge": "br0", + "hostname": "tf-k8s-slave-2", + "mac": "52:54:00:E2:56:48", + "macvtap": "", + "network_id": "", + "network_name": "", + "passthrough": "", + "vepa": "", + "wait_for_lease": false + } + ], + "nvram": [], + "qemu_agent": true, + "running": true, + "timeouts": null, + "vcpu": 2, + "video": [], + "xml": [] + }, + "sensitive_attributes": [], + "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==", + "dependencies": [ + "data.template_file.network_config", + "data.template_file.slaves_user_data", + "libvirt_cloudinit_disk.slaves_commoninit", + "libvirt_pool.tf_pool", + "libvirt_volume.k8sslaves-qcow2" + ] } ] }, @@ -76,14 +494,13 @@ "provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]", "instances": [ { - "status": "tainted", "schema_version": 0, "attributes": { "arch": "x86_64", "autostart": false, "boot_device": [], - "cloudinit": "/mnt/data1/libvirt_tf_volumes/commoninit.iso;60acffa2-a30b-dd14-e627-608200b09a37", - "cmdline": null, + "cloudinit": "/mnt/data1/libvirt_tf_volumes/commoninit.iso;60b0949a-f28d-32dc-4bd4-96e4dba4d36b", + "cmdline": [], "console": [ { "source_host": "127.0.0.1", @@ -127,44 +544,46 @@ "type": "spice" } ], - "id": "abb9c651-02d6-4bf8-b695-849b47dbfb95", + "id": "4659e18e-9de6-46c8-a0e0-afaed7dfc996", "initrd": "", "kernel": "", "machine": "pc", - "memory": 512, + "memory": 4096, "metadata": null, - "name": "terraform-kvm-ansible", + "name": "tf-k8s-master", "network_interface": [ { "addresses": [ - "192.168.20.71", - "fe80::5054:ff:feb6:e535" + "192.168.20.118", + "fe80::5054:ff:fe7e:cd71" ], "bridge": "br0", - "hostname": "terraform-kvm-ansible", - "mac": "52:54:00:B6:E5:35", + "hostname": "tf-k8s-master", + "mac": "52:54:00:7E:CD:71", "macvtap": "", "network_id": "", "network_name": "", "passthrough": "", "vepa": "", - "wait_for_lease": true + "wait_for_lease": false } ], "nvram": [], "qemu_agent": true, "running": true, "timeouts": null, - "vcpu": 1, + "vcpu": 2, "video": [], "xml": [] }, "sensitive_attributes": [], "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjozMDAwMDAwMDAwMDB9fQ==", "dependencies": [ - "libvirt_cloudinit_disk.commoninit", "libvirt_pool.tf_pool", - "libvirt_volume.ubuntu-qcow2" + "libvirt_volume.ubuntu-qcow2", + "data.template_file.network_config", + "data.template_file.user_data", + "libvirt_cloudinit_disk.commoninit" ] } ] @@ -178,7 +597,7 @@ { "schema_version": 0, "attributes": { - "allocation": 220629524480, + "allocation": 222854959104, "available": null, "capacity": 1967792529408, "id": "40b537c5-c26e-49d3-9660-3bfe18eb0907", @@ -192,6 +611,77 @@ } ] }, + { + "mode": "managed", + "type": "libvirt_volume", + "name": "k8sslaves-qcow2", + "provider": "provider[\"registry.terraform.io/dmacvicar/libvirt\"]", + "instances": [ + { + "index_key": 0, + "schema_version": 0, + "attributes": { + "base_volume_id": null, + "base_volume_name": null, + "base_volume_pool": null, + "format": "qcow2", + "id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-0.qcow2", + "name": "k8sslaves-0.qcow2", + "pool": "tf_pool", + "size": 21474836480, + "source": "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img", + "xml": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "libvirt_pool.tf_pool" + ] + }, + { + "index_key": 1, + "schema_version": 0, + "attributes": { + "base_volume_id": null, + "base_volume_name": null, + "base_volume_pool": null, + "format": "qcow2", + "id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-1.qcow2", + "name": "k8sslaves-1.qcow2", + "pool": "tf_pool", + "size": 21474836480, + "source": "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img", + "xml": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "libvirt_pool.tf_pool" + ] + }, + { + "index_key": 2, + "schema_version": 0, + "attributes": { + "base_volume_id": null, + "base_volume_name": null, + "base_volume_pool": null, + "format": "qcow2", + "id": "/mnt/data1/libvirt_tf_volumes/k8sslaves-2.qcow2", + "name": "k8sslaves-2.qcow2", + "pool": "tf_pool", + "size": 21474836480, + "source": "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img", + "xml": [] + }, + "sensitive_attributes": [], + "private": "bnVsbA==", + "dependencies": [ + "libvirt_pool.tf_pool" + ] + } + ] + }, { "mode": "managed", "type": "libvirt_volume", @@ -208,8 +698,8 @@ "id": "/mnt/data1/libvirt_tf_volumes/ubuntu-qcow2", "name": "ubuntu-qcow2", "pool": "tf_pool", - "size": 2361393152, - "source": "http://cloud-images.ubuntu.com/releases/bionic/release-20191008/ubuntu-18.04-server-cloudimg-amd64.img", + "size": 21474836480, + "source": "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img", "xml": [] }, "sensitive_attributes": [], diff --git a/variables.tf b/variables.tf index 3077cf4..e95c4b8 100644 --- a/variables.tf +++ b/variables.tf @@ -9,9 +9,45 @@ variable "ubuntu_18_img_url" { default = "http://cloud-images.ubuntu.com/releases/bionic/release-20191008/ubuntu-18.04-server-cloudimg-amd64.img" } +variable "ubuntu_20_img_url" { + description = "ubuntu 20.04 image" + #default = "https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.img" + default = "/home/tobias/projects/terraform-libvirt/ubuntu-20.04-server-cloudimg-amd64.img" +} + +variable "vm_disk_size" { + description = "size of the disk of the virtual machine" + default = 21549672960 +} + +variable "vm_name" { + description = "vm name" + default = "tf-k8s-master" +} + variable "vm_hostname" { description = "vm hostname" - default = "terraform-kvm-ansible" + default = "k8smaster" +} + +variable "vm_slave_hostname" { + description = "vm hostname" + default = "k8slave" +} + +variable "slaves" { + type = number + default = 3 +} + +variable "vm_slave_name" { + description = "vm slave name" + default = "tf-k8s-slave" +} + +variable "vm_slave_hostname" { + description = "vm slave hostname" + default = "k8sslave" } variable "ssh_username" {