4 Commits

Author SHA1 Message Date
fcdc7d07ad Add ansible payload draft
Some checks failed
continuous-integration/drone/push Build is failing
2021-06-09 10:39:00 +02:00
998f5ef381 Remove multiline descriptions for deployment options 2021-06-08 22:28:40 +02:00
a9041b19a4 Housekeeping 2021-06-08 22:16:52 +02:00
0a2647d465 Hide deprecation warnings 2021-06-08 22:13:46 +02:00
10 changed files with 81 additions and 30 deletions

View File

@@ -1,2 +1,3 @@
[defaults]
remote_tmp = /tmp/.ansible-${USER}/tmp
deprecation_warnings = False
remote_tmp = /tmp/.ansible-${USER}/tmp

View File

@@ -0,0 +1,8 @@
---
- hosts: 127.0.0.1
connection: local
gather_facts: false
# become: true
roles:
- vapp
- network

View File

@@ -0,0 +1,41 @@
- name: Store current vApp configuration
ansible.builtin.shell:
cmd: vmtoolsd --cmd "info-get guestinfo.ovfEnv"
register: ovfEnv
- name: Parse XML into variables
community.general.xml:
xmlstring: "{{ ovfEnv }}"
namespaces:
oe: http://schemas.dmtf.org/ovf/environment/1
xpath: /Environment/PropertySection/Property
content: oe:key
# <?xml version="1.0" encoding="UTF-8"?>
# <Environment
# xmlns="http://schemas.dmtf.org/ovf/environment/1"
# xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
# xmlns:oe="http://schemas.dmtf.org/ovf/environment/1"
# xmlns:ve="http://www.vmware.com/schema/ovfenv"
# oe:id=""
# ve:vCenterId="vm-1171">
# <PlatformSection>
# <Kind>VMware ESXi</Kind>
# <Version>7.0.1</Version>
# <Vendor>VMware, Inc.</Vendor>
# <Locale>en</Locale>
# </PlatformSection>
# <PropertySection>
# <Property oe:key="deployment.type" oe:value="ubuntu-small"/>
# <Property oe:key="guestinfo.dnsserver" oe:value="1.1.1.1"/>
# <Property oe:key="guestinfo.gateway" oe:value="10.0.0.1"/>
# <Property oe:key="guestinfo.hostname" oe:value="SRV01"/>
# <Property oe:key="guestinfo.ipaddress" oe:value="10.0.0.84"/>
# <Property oe:key="guestinfo.ntpserver" oe:value="0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org"/>
# <Property oe:key="guestinfo.prefixlength" oe:value="24"/>
# <Property oe:key="guestinfo.rootpw" oe:value=""/>
# </PropertySection>
# <ve:EthernetAdapterSection>
# <ve:Adapter ve:mac="00:50:56:8a:09:08" ve:network="Staging" ve:unitNumber="7"/>
# </ve:EthernetAdapterSection>
# </Environment>

View File

@@ -1,7 +1,7 @@
- name: Copy firstboot script file
ansible.builtin.copy:
src: firstboot.sh
dest: /opt/firstboot.sh
- name: Create firstboot script file
ansible.builtin.template:
src: firstboot.j2
dest: /opt/firstboot/firstboot.sh
owner: root
group: root
mode: o+x
@@ -9,4 +9,14 @@
ansible.builtin.cron:
name: "firstboot"
special_time: reboot
job: "/opt/firstboot.sh"
job: "/opt/firstboot/firstboot.sh"
- name: Copy payload folder
ansible.builtin.copy:
src: ansible_payload/
dest: /opt/firstboot/ansible/
owner: root
group: root
mode: '0644'
- name: Install ansible-galaxy collection
ansible.builtin.shell:
cmd: ansible-galaxy collection install community.general

View File

@@ -1,9 +1,6 @@
#cloud-config
autoinstall:
version: 1
# early-commands:
# # Block inbound SSH to stop Packer trying to connect during initial install
# - iptables -A INPUT -p tcp --dport 22 -j DROP
locale: en_US
keyboard:
layout: en
@@ -24,8 +21,6 @@ autoinstall:
ssh:
install-server: yes
allow-pw: true
# authorized-keys:
# - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCi9eAu6KBaShdcL4pxi6/sJp+IS6nCKexcjQdwFLxg+EoiT2MTAnMsjnfi570het+VV+iOigcZLuRwEcAPh6rSQOtpikmpV6WFjzToWq9aUxDrxWsp/iEPHp+sbjrlsdnGvLGY9XhmPs9s5I8xFQbwF6ilhMIQm+RxtGJJuPUWaF+uXo+3CB91A6bK/rjs97iAjrPZRs0vo5hJGqrIGFi3WP9hf8hF9oWz2BiLRYBib3il6lsAl4Ca0sI//gNM0Ztj4gB7qv1+uPz157bk0IZoN285/72l/rUZVSPIwO+QFZFK07FsyVrpAgMlHk65BiSAO4DtolZEArfXRE1g1DH/ mail@example.com
user-data:
disable_root: false
late-commands:

View File

@@ -88,7 +88,7 @@ build {
" -ManifestFileName '/scratch/ubuntuserver/${var.vm_guestos}-${var.vm_name}.mf'",
"ovftool --acceptAllEulas --allowExtraConfig --overwrite \\",
" '/scratch/ubuntuserver/${var.vm_guestos}-${var.vm_name}.ovf' \\",
" /output/UbuntuServer20.04.ova"
" /output/Ubuntu-Server-20.04.ova"
]
}
}

View File

@@ -1,30 +1,26 @@
DeploymentConfigurations:
- Id: ubuntu-small
Label: 'Ubuntu Server 20.04 [SMALL]'
Description: |
Ubuntu Server 20.04
1 vCPU/2GB RAM
- Id: small
Label: 'Ubuntu Server 20.04 [SMALL: 1 vCPU/2GB RAM]'
Description: Ubuntu Server 20.04.x
Size:
CPU: 1
Memory: 2048
- Id: ubuntu-large
Label: 'Ubuntu Server 20.04 [LARGE]'
Description: |
Ubuntu Server 20.04
4 vCPU/8GB RAM
- Id: large
Label: 'Ubuntu Server 20.04 [LARGE: 4 vCPU/8GB RAM]'
Description: Ubuntu Server 20.04.x
Size:
CPU: 4
Memory: 8192
DynamicDisks: []
PropertyCategories:
- Name: 0) Deployment information
ProductProperties:
- Key: deployment.type
Type: string
Value:
- ubuntu-small
- ubuntu-large
UserConfigurable: false
# - Name: 0) Deployment information
# ProductProperties:
# - Key: deployment.type
# Type: string
# Value:
# - small
# - large
# UserConfigurable: false
- Name: 1) Operating System
ProductProperties:
- Key: guestinfo.hostname