Adding self installation command for fabrica
This commit is contained in:
95
.packer/recipes/alpine/3.10/virt.json
Normal file
95
.packer/recipes/alpine/3.10/virt.json
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"alpine_provisionning": "{{ user `provisionning_dir`}}/alpine",
|
||||
"al_mirror": "http://dl-cdn.alpinelinux.org/alpine",
|
||||
"al_release": "3.10.2",
|
||||
"al_version": "3.10",
|
||||
"al_flavour": "alpine-virt",
|
||||
"vm_name": "alpine-310",
|
||||
"root_password": "cadoles",
|
||||
"disk_size": "10240",
|
||||
"headless": "true"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{ user `al_mirror` }}/v{{ user `al_version` }}/releases/x86_64/{{ user `al_flavour` }}-{{ user `al_release` }}-x86_64.iso",
|
||||
"iso_checksum": "file:{{ user `alpine_provisionning` }}/sums/{{ user `al_flavour` }}-{{ user `al_release` }}-x86_64.iso.sha256",
|
||||
"format": "qcow2",
|
||||
"disk_size": "{{user `disk_size`}}",
|
||||
"disk_compression": false,
|
||||
"skip_compaction": true,
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "{{user `root_password`}}",
|
||||
"accelerator": "kvm",
|
||||
"headless": "{{user `headless`}}",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"boot_wait": "5s",
|
||||
"boot_command": [
|
||||
"<wait5s>root<enter>",
|
||||
"<wait1s><enter>",
|
||||
"<wait1s>passwd<enter><wait1s>cadoles<enter><wait1s>cadoles<enter>",
|
||||
"<wait1s>setup-interfaces<enter><wait1s><enter><wait1s><enter><wait1s><enter>",
|
||||
"<wait1s>ifup eth0<enter>",
|
||||
"<wait1s>setup-sshd<enter>",
|
||||
"<wait1s><enter><wait1s>",
|
||||
"<wait1s>echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config<enter>",
|
||||
"<wait1s>rc-service sshd stop<enter>",
|
||||
"<wait1s>rc-service sshd start<enter>",
|
||||
"<wait1s><enter>"
|
||||
],
|
||||
"ssh_wait_timeout": "20m",
|
||||
"output_directory": "{{ template_dir }}/../../../images/alpine/{{user `al_version`}}/{{ user `al_flavour` }}",
|
||||
"vm_name": "{{ build_name }}-{{ isotime \"20060102\" }}.img"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type":"file",
|
||||
"source":"{{ user `provisionning_dir`}}/ssl",
|
||||
"destination":"/usr/local/share/ca-certificates/"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"expect_disconnect": true,
|
||||
"script": "{{ user `alpine_provisionning` }}/setup-alpine.sh",
|
||||
"environment_vars": [
|
||||
"VM_NAME={{user `vm_name`}}",
|
||||
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
||||
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
||||
"http_proxy={{user `http_proxy`}}",
|
||||
"https_proxy={{user `https_proxy`}}",
|
||||
"ROOT_PASSWORD={{user `root_password`}}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"pause_before": "30s",
|
||||
"type": "shell",
|
||||
"scripts": [
|
||||
"{{ user `alpine_provisionning` }}/configure-onecontext.sh",
|
||||
"{{ user `alpine_provisionning` }}/finalize.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
"VM_NAME={{user `vm_name`}}",
|
||||
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
||||
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
||||
"http_proxy={{user `http_proxy`}}",
|
||||
"https_proxy={{user `https_proxy`}}",
|
||||
"ROOT_PASSWORD={{user `root_password`}}"
|
||||
]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [ "sleep 5","qemu-img convert -O qcow2 -c {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ build_name }}-{{ isotime \"20060102\" }}.img {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ user `al_flavour` }}-{{ user `al_version` }}.img" ,
|
||||
"rm -rf {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ build_name }}-{{ isotime \"20060102\" }}.img" ]
|
||||
}
|
||||
]
|
||||
}
|
94
.packer/recipes/alpine/3.12/virt.json
Normal file
94
.packer/recipes/alpine/3.12/virt.json
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"headless": "true",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"alpine_provisionning": "{{ user `provisionning_dir`}}/alpine",
|
||||
"root_password": "cadoles",
|
||||
"al_flavour": "alpine-virt",
|
||||
"al_mirror": "http://dl-cdn.alpinelinux.org/alpine",
|
||||
"al_release": "3.12.0",
|
||||
"al_version": "3.12",
|
||||
"disk_size": "10240",
|
||||
"vm_name": "alpine-312"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"accelerator": "kvm",
|
||||
"boot_command": [
|
||||
"<wait5s>root<enter>",
|
||||
"<wait1s><enter>",
|
||||
"<wait1s>passwd<enter><wait1s>cadoles<enter><wait1s>cadoles<enter>",
|
||||
"<wait1s>setup-interfaces<enter><wait1s><enter><wait1s><enter><wait1s><enter>",
|
||||
"<wait1s>ifup eth0<enter>",
|
||||
"<wait1s>setup-sshd<enter>",
|
||||
"<wait1s><enter><wait1s>",
|
||||
"<wait1s>echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config<enter>",
|
||||
"<wait1s>rc-service sshd stop<enter>",
|
||||
"<wait1s>rc-service sshd start<enter>",
|
||||
"<wait1s><enter>"
|
||||
],
|
||||
"boot_wait": "5s",
|
||||
"disk_compression": false,
|
||||
"disk_size": "{{user `disk_size`}}",
|
||||
"format": "qcow2",
|
||||
"headless": "{{user `headless`}}",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"iso_checksum": "file:{{ user `alpine_provisionning` }}/sums/{{ user `al_flavour` }}-{{ user `al_release` }}-x86_64.iso.sha256",
|
||||
"iso_url": "{{ user `al_mirror` }}/v{{ user `al_version` }}/releases/x86_64/{{ user `al_flavour` }}-{{ user `al_release` }}-x86_64.iso",
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"output_directory": "{{ template_dir }}/../../../images/alpine/{{user `al_version`}}/{{ user `al_flavour` }}",
|
||||
"skip_compaction": true,
|
||||
"ssh_password": "{{user `root_password`}}",
|
||||
"ssh_timeout": "20m",
|
||||
"ssh_username": "root",
|
||||
"type": "qemu",
|
||||
"vm_name": "{{ build_name }}-{{ isotime \"20060102\" }}.img"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"environment_vars": [
|
||||
"VM_NAME={{user `vm_name`}}",
|
||||
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
||||
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
||||
"http_proxy={{user `http_proxy`}}",
|
||||
"https_proxy={{user `https_proxy`}}",
|
||||
"ROOT_PASSWORD={{user `root_password`}}"
|
||||
],
|
||||
"expect_disconnect": true,
|
||||
"script": "{{ user `alpine_provisionning` }}/setup-alpine.sh",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"environment_vars": [
|
||||
"VM_NAME={{user `vm_name`}}",
|
||||
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
||||
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
||||
"http_proxy={{user `http_proxy`}}",
|
||||
"https_proxy={{user `https_proxy`}}",
|
||||
"ROOT_PASSWORD={{user `root_password`}}"
|
||||
],
|
||||
"pause_before": "30s",
|
||||
"scripts": [
|
||||
"{{ user `alpine_provisionning` }}/configure-onecontext.sh",
|
||||
"{{ user `alpine_provisionning` }}/finalize.sh"
|
||||
],
|
||||
"type": "shell"
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O qcow2 -c {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ build_name }}-{{ isotime \"20060102\" }}.img {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ user `al_flavour` }}-{{ user `al_version` }}.img",
|
||||
"rm -rf {{ template_dir }}/../../../images/alpine/{{ user `al_version` }}/{{ user `al_flavour` }}/{{ build_name }}-{{ isotime \"20060102\" }}.img"
|
||||
],
|
||||
"type": "shell-local"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
85
.packer/recipes/eole/2.7.2/amon.json
Normal file
85
.packer/recipes/eole/2.7.2/amon.json
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"eole_provisionning": "{{ user `provisionning_dir`}}/eole",
|
||||
"eole_playbooks": "{{ user `provisionning_dir` }}/playbooks/eole",
|
||||
"module_name": "amon",
|
||||
"ubuntu_version": "18.04",
|
||||
"eole_version": "2.7.2",
|
||||
"vm_name": "amon-2.7.2",
|
||||
"image_size": "40960",
|
||||
"output_dir": "{{ template_dir }}/../../../images/eole/2.7.2/{{ user `module_name` }}",
|
||||
"image_name": "{{ user `vm_name` }}-{{ isotime \"20060102\" }}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{ template_dir }}/../../../images/eole/{{user `eole_version`}}/eolebase/eolebase-{{ user `eole_version` }}.img",
|
||||
"iso_checksum": "none",
|
||||
"disk_image": true,
|
||||
"format": "qcow2",
|
||||
"disk_size": "{{ user `image_size` }}",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"accelerator": "kvm",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"ssh_wait_timeout": "5m",
|
||||
"boot_wait": "5s",
|
||||
"output_directory": "{{ user `output_dir` }}",
|
||||
"vm_name": "{{ user `image_name` }}.img",
|
||||
"headless": true,
|
||||
"qemuargs": [
|
||||
[
|
||||
"-m",
|
||||
"2048"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/partitions.yml",
|
||||
"ansible_env_vars": [
|
||||
"VM_NAME={{ user `vm_name` }}",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY={{ user `HTTPS_PROXY` }}",
|
||||
"http_proxy={{ user `http_proxy` }}",
|
||||
"https_proxy={{ user `https_proxy` }}",
|
||||
"vgname=main",
|
||||
"lvnames=var",
|
||||
"lvsizes=80%FREE",
|
||||
"lvfssys=ext4",
|
||||
"lvmntps=/var"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [ "reboot" ],
|
||||
"expect_disconnect": true
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/{{ user `module_name` }}.yml",
|
||||
"extra_arguments": [ "--extra-vars", "VM_NAME={{ user `vm_name` }} HTTP_PROXY={{ user `HTTP_PROXY` }} HTTPS_PROXY={{ user `HTTPS_PROXY` }} http_proxy={{ user `http_proxy` }} https_proxy={{ user `https_proxy` }}"]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O qcow2 -c {{ user `output_dir` }}/{{ user `image_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.img",
|
||||
"rm -rf {{ user `output_dir` }}/{{ user `image_name` }}.img"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
96
.packer/recipes/eole/2.7.2/eolebase.json
Normal file
96
.packer/recipes/eole/2.7.2/eolebase.json
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"eole_provisionning": "{{ user `provisionning_dir`}}/eole",
|
||||
"eole_playbooks": "{{ user `provisionning_dir` }}/playbooks/eole",
|
||||
"module_name": "eolebase",
|
||||
"ubuntu_version": "18.04",
|
||||
"eole_version": "2.7.2",
|
||||
"vm_name": "eolebase-2.7.2",
|
||||
"image_size": "10240",
|
||||
"output_dir": "{{ template_dir }}/../../../images/eole/2.7.2/{{ user `module_name` }}",
|
||||
"image_name": "{{ user `vm_name` }}-{{ isotime \"20060102\" }}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{ template_dir }}/../../../images/ubuntu/{{user `ubuntu_version`}}/ubuntu-{{ user `ubuntu_version` }}.img",
|
||||
"iso_checksum": "none",
|
||||
"disk_image": true,
|
||||
"format": "qcow2",
|
||||
"vnc_bind_address": "0.0.0.0",
|
||||
"disk_size": "{{ user `image_size` }}",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"accelerator": "kvm",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"ssh_wait_timeout": "45m",
|
||||
"boot_wait": "5s",
|
||||
"output_directory": "{{ user `output_dir` }}",
|
||||
"vm_name": "{{ user `image_name` }}.img",
|
||||
"headless": true,
|
||||
"cpus": "2",
|
||||
"memory" : "4096"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{ user `eole_provisionning` }}/onecontext/net-99-eole",
|
||||
"destination": "/root/net-99-eole"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{ user `eole_provisionning` }}/{{ user `eole_version` }}/modif/00-eole.yaml",
|
||||
"destination": "/root/00-eole.yaml"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{ user `eole_provisionning` }}/{{ user `eole_version` }}/netplan/01-netcfg.yaml",
|
||||
"destination": "/etc/netplan/01-netcfg.yaml"
|
||||
},
|
||||
{
|
||||
"type":"file",
|
||||
"source":"{{user `provisionning_dir` }}/ssl",
|
||||
"destination":"/usr/local/share/ca-certificates/rapidssl"
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{user `eole_playbooks`}}/eole.yml",
|
||||
"extra_arguments": [
|
||||
"--extra-vars",
|
||||
"VM_NAME={{ user `vm_name` }} EOLE_VERSION={{ user `eole_version` }}",
|
||||
"--extra-vars",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }} HTTPS_PROXY={{ user `HTTPS_PROXY` }} http_proxy={{ user `http_proxy` }} https_proxy={{ user `https_proxy` }}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type":"ansible",
|
||||
"playbook_file":"{{ user `eole_playbooks` }}/provision.yml",
|
||||
"extra_arguments": [
|
||||
"--extra-vars",
|
||||
"VM_NAME={{ user `vm_name` }} EOLE_VERSION={{ user `eole_version` }}",
|
||||
"--extra-vars",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }} HTTPS_PROXY={{ user `HTTPS_PROXY` }} http_proxy={{ user `http_proxy` }} https_proxy={{ user `https_proxy` }}"
|
||||
]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O qcow2 -c {{ user `output_dir` }}/{{ user `image_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.img",
|
||||
"rm -rf {{ user `output_dir` }}/{{ user `image_name` }}.img"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
92
.packer/recipes/eole/2.7.2/lemonldap.json
Normal file
92
.packer/recipes/eole/2.7.2/lemonldap.json
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"eole_provisionning": "{{ user `provisionning_dir`}}/eole",
|
||||
"eole_playbooks": "{{ user `provisionning_dir` }}/playbooks/eole",
|
||||
"module_name": "lemonldap",
|
||||
"ubuntu_version": "18.04",
|
||||
"eole_version": "2.7.2",
|
||||
"vm_name": "lemonldap-2.7.2",
|
||||
"image_size": "20480",
|
||||
"output_dir": "{{ template_dir }}/../../../images/eole/2.7.2/{{ user `module_name` }}",
|
||||
"image_name": "{{ user `vm_name` }}-{{ isotime \"20060102\" }}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{ template_dir }}/../../../images/eole/{{user `eole_version`}}/eolebase/eolebase-{{ user `eole_version` }}.img",
|
||||
"iso_checksum": "none",
|
||||
"disk_image": true,
|
||||
"format": "qcow2",
|
||||
"disk_size": "{{ user `image_size` }}",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"accelerator": "kvm",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"ssh_wait_timeout": "5m",
|
||||
"boot_wait": "5s",
|
||||
"output_directory": "{{ user `output_dir` }}",
|
||||
"vm_name": "{{ user `image_name` }}.img",
|
||||
"headless": true,
|
||||
"qemuargs": [
|
||||
[
|
||||
"-m",
|
||||
"2048"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/partitions.yml",
|
||||
"ansible_env_vars": [
|
||||
"VM_NAME={{ user `vm_name` }}",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY={{ user `HTTPS_PROXY` }}",
|
||||
"http_proxy={{ user `http_proxy` }}",
|
||||
"https_proxy={{ user `https_proxy` }}",
|
||||
"vgname=main",
|
||||
"lvnames=var",
|
||||
"lvsizes=80%FREE",
|
||||
"lvfssys=ext4",
|
||||
"lvmntps=/var"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [ "reboot" ],
|
||||
"expect_disconnect": true
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/{{ user `module_name` }}.yml",
|
||||
"extra_arguments": [ "--extra-vars", "VM_NAME={{ user `vm_name` }} HTTP_PROXY={{ user `HTTP_PROXY` }} HTTPS_PROXY={{ user `HTTPS_PROXY` }} http_proxy={{ user `http_proxy` }} https_proxy={{ user `https_proxy` }}"]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O qcow2 -c {{ user `output_dir` }}/{{ user `image_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.img",
|
||||
"rm -rf {{ user `output_dir` }}/{{ user `image_name` }}.img"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O vdi {{ user `output_dir` }}/{{ user `vm_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.vdi"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
92
.packer/recipes/eole/2.7.2/minio.json
Normal file
92
.packer/recipes/eole/2.7.2/minio.json
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"eole_provisionning": "{{ user `provisionning_dir`}}/eole",
|
||||
"eole_playbooks": "{{ user `provisionning_dir` }}/playbooks/eole",
|
||||
"module_name": "minio",
|
||||
"ubuntu_version": "18.04",
|
||||
"eole_version": "2.7.2",
|
||||
"vm_name": "minio-2.7.2",
|
||||
"image_size": "102400",
|
||||
"output_dir": "{{ template_dir }}/../../../images/eole/2.7.2/{{ user `module_name` }}",
|
||||
"image_name": "{{ user `vm_name` }}-{{ isotime \"20060102\" }}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{ template_dir }}/../../../images/eole/{{user `eole_version`}}/eolebase/eolebase-{{ user `eole_version` }}.img",
|
||||
"iso_checksum": "none",
|
||||
"disk_image": true,
|
||||
"format": "qcow2",
|
||||
"disk_size": "{{ user `image_size` }}",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"accelerator": "kvm",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"ssh_wait_timeout": "5m",
|
||||
"boot_wait": "5s",
|
||||
"output_directory": "{{ user `output_dir` }}",
|
||||
"vm_name": "{{ user `image_name` }}.img",
|
||||
"headless": true,
|
||||
"qemuargs": [
|
||||
[
|
||||
"-m",
|
||||
"2048"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/partitions.yml",
|
||||
"ansible_env_vars": [
|
||||
"VM_NAME={{ user `vm_name` }}",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY={{ user `HTTPS_PROXY` }}",
|
||||
"http_proxy={{ user `http_proxy` }}",
|
||||
"https_proxy={{ user `https_proxy` }}",
|
||||
"vgname=main",
|
||||
"lvnames=ds1 ds2 ds3 ds4 ds5 ds6 ds7 ds8",
|
||||
"lvsizes=10G 10G 10G 10G 10G 10G 10G 10G",
|
||||
"lvfssys=ext4 ext4 ext4 ext4 ext4 ext4 ext4 ext4",
|
||||
"lvmntps=/srv/ds1 /srv/ds2 /srv/ds3 /srv/ds4 /srv/ds5 /srv/ds6 /srv/ds7 /srv/ds8"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [ "reboot" ],
|
||||
"expect_disconnect": true
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/{{ user `module_name` }}.yml",
|
||||
"extra_arguments": [ "--extra-vars", "VM_NAME={{ user `vm_name` }} HTTP_PROXY={{ user `HTTP_PROXY` }} HTTPS_PROXY={{ user `HTTPS_PROXY` }} http_proxy={{ user `http_proxy` }} https_proxy={{ user `https_proxy` }}"]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O qcow2 -c {{ user `output_dir` }}/{{ user `image_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.img",
|
||||
"rm -rf {{ user `output_dir` }}/{{ user `image_name` }}.img"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O vdi {{ user `output_dir` }}/{{ user `vm_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.vdi"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
4
.packer/recipes/eole/2.7.2/preseed.cfg
Normal file
4
.packer/recipes/eole/2.7.2/preseed.cfg
Normal file
@ -0,0 +1,4 @@
|
||||
openssh-server/permit-root-login boolean true
|
||||
|
||||
d-i preseed/late_command string in-target /bin/bash -c "chpasswd -c SHA512 <<<'root:cadoles'"
|
||||
d-i preseed/late_command string in-target /bin/bash -c "sed -i 's/^#PermitRootLogin.*\$/PermitRootLogin yes/g' /etc/ssh/sshd_config";
|
76
.packer/recipes/eole/2.7.2/provision.sh
Normal file
76
.packer/recipes/eole/2.7.2/provision.sh
Normal file
@ -0,0 +1,76 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Download OpenNebula context package
|
||||
ONE_CONTEXT_VERSION=5.8.0
|
||||
ONE_CONTEXT_BUILD_SUFFIX=-1
|
||||
ONE_CONTEXT_SHASUM=cfcc8aa2e51396935e8d2a507f996838201515b5
|
||||
ONE_CONTEXT_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v${ONE_CONTEXT_VERSION}/one-context_${ONE_CONTEXT_VERSION}${ONE_CONTEXT_BUILD_SUFFIX}.deb"
|
||||
ONE_CONTEXT_PACKAGE_DEST=/tmp/one-context.deb
|
||||
|
||||
wget -O- "${ONE_CONTEXT_URL}" > "${ONE_CONTEXT_PACKAGE_DEST}"
|
||||
echo "${ONE_CONTEXT_SHASUM} ${ONE_CONTEXT_PACKAGE_DEST}" | shasum -c
|
||||
|
||||
# Purge cloud-init
|
||||
#apt-get purge -y cloud-init
|
||||
|
||||
# Install onecontext
|
||||
Query-Auto
|
||||
dpkg -i "${ONE_CONTEXT_PACKAGE_DEST}" || apt-get install -fy
|
||||
|
||||
# Ajout script de compat contextualisation OpenNebula/EOLE
|
||||
apt-get install -y jq
|
||||
mv /root/net-99-eole /etc/one-context.d/net-99-eole
|
||||
chmod +x /etc/one-context.d/net-99-eole
|
||||
|
||||
# Allow TCP Forwarding to ease GenConfig usage
|
||||
sed 's/^AllowTcpForwarding.*$/AllowTcpForwarding yes/' /usr/share/eole/creole/distrib/sshd_config > /usr/share/eole/creole/modif/sshd_config
|
||||
|
||||
# Ajout patch configuration DHCPv6
|
||||
mv /root/00-eole.yaml /usr/share/eole/creole/modif/00-eole.yaml
|
||||
|
||||
gen_patch
|
||||
|
||||
# Update hostname
|
||||
hostnamectl set-hostname "${VM_NAME}"
|
||||
|
||||
# Disable root login with password
|
||||
# sed -i 's/^PermitRootLogin.*$/PermitRootLogin without-password/' /etc/ssh/sshd_config
|
||||
|
||||
# Cleanup
|
||||
rm -f "${ONE_CONTEXT_PACKAGE_DEST}"
|
||||
apt-get -y clean
|
||||
|
||||
# Update image with latest packages
|
||||
Maj-Auto -i
|
||||
|
||||
# Clean all apt cache
|
||||
apt clean
|
||||
|
||||
# TEMP Prevent EOLE 2.7.0 fucking bugs
|
||||
systemctl disable gpm # Allow fucking login in VNC
|
||||
|
||||
# Disable nut-(driver|monitor)
|
||||
systemctl mask nut-driver
|
||||
systemctl disable nut-monitor
|
||||
|
||||
# Disable IPv6 to allow the VM to fucking boot
|
||||
sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT=.*$/GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"/' /etc/default/grub
|
||||
update-grub
|
||||
|
||||
# TRIM command to reduce disk size
|
||||
fstrim -av
|
||||
|
||||
# Zero out the disk (could be very long)
|
||||
set +e
|
||||
FILE=/mytempfile
|
||||
dd if=/dev/zero of=${FILE}
|
||||
rm -rf ${FILE}
|
||||
sync
|
||||
set -e
|
||||
|
||||
# Force sync
|
||||
sync
|
85
.packer/recipes/eole/2.7.2/seth.json
Normal file
85
.packer/recipes/eole/2.7.2/seth.json
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"eole_provisionning": "{{ user `provisionning_dir`}}/eole",
|
||||
"eole_playbooks": "{{ user `provisionning_dir` }}/playbooks/eole",
|
||||
"module_name": "seth",
|
||||
"ubuntu_version": "18.04",
|
||||
"eole_version": "2.7.2",
|
||||
"vm_name": "seth-2.7.2",
|
||||
"image_size": "51200",
|
||||
"output_dir": "{{ template_dir }}/../../../images/eole/2.7.2/{{ user `module_name` }}",
|
||||
"image_name": "{{ user `vm_name` }}-{{ isotime \"20060102\" }}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{ template_dir }}/../../../images/eole/{{user `eole_version`}}/eolebase/eolebase-{{ user `eole_version` }}.img",
|
||||
"iso_checksum": "none",
|
||||
"disk_image": true,
|
||||
"format": "qcow2",
|
||||
"disk_size": "{{ user `image_size` }}",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"accelerator": "kvm",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"ssh_wait_timeout": "5m",
|
||||
"boot_wait": "5s",
|
||||
"output_directory": "{{ user `output_dir` }}",
|
||||
"vm_name": "{{ user `image_name` }}.img",
|
||||
"headless": true,
|
||||
"qemuargs": [
|
||||
[
|
||||
"-m",
|
||||
"2048"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/partitions.yml",
|
||||
"ansible_env_vars": [
|
||||
"VM_NAME={{ user `vm_name` }}",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY={{ user `HTTPS_PROXY` }}",
|
||||
"http_proxy={{ user `http_proxy` }}",
|
||||
"https_proxy={{ user `https_proxy` }}",
|
||||
"vgname=main",
|
||||
"lvnames=home var tmp",
|
||||
"lvsizes=80%FREE 90%FREE 100%FREE",
|
||||
"lvfssys=ext4 ext4 ext4",
|
||||
"lvmntps=/home /var /tmp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [ "reboot" ],
|
||||
"expect_disconnect": true
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/{{ user `module_name` }}.yml",
|
||||
"extra_arguments": [ "--extra-vars", "VM_NAME={{ user `vm_name` }} HTTP_PROXY={{ user `HTTP_PROXY` }} HTTPS_PROXY={{ user `HTTPS_PROXY` }} http_proxy={{ user `http_proxy` }} https_proxy={{ user `https_proxy` }}"]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O qcow2 -c {{ user `output_dir` }}/{{ user `image_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.img",
|
||||
"rm -rf {{ user `output_dir` }}/{{ user `image_name` }}.img"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
92
.packer/recipes/eole/2.7.2/tenjin.json
Normal file
92
.packer/recipes/eole/2.7.2/tenjin.json
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"eole_provisionning": "{{ user `provisionning_dir`}}/eole",
|
||||
"eole_playbooks": "{{ user `provisionning_dir` }}/playbooks/eole",
|
||||
"module_name": "tenjin",
|
||||
"ubuntu_version": "18.04",
|
||||
"eole_version": "2.7.2",
|
||||
"vm_name": "tenjin-2.7.2",
|
||||
"image_size": "100G",
|
||||
"output_dir": "{{ template_dir }}/../../../images/eole/2.7.2/{{ user `module_name` }}",
|
||||
"image_name": "{{ user `vm_name` }}-{{ isotime \"20060102\" }}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{ template_dir }}/../../../images/eole/{{user `eole_version`}}/eolebase/eolebase-{{ user `eole_version` }}.img",
|
||||
"iso_checksum": "none",
|
||||
"disk_image": true,
|
||||
"format": "qcow2",
|
||||
"disk_size": "{{ user `image_size` }}",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"accelerator": "kvm",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"ssh_wait_timeout": "5m",
|
||||
"boot_wait": "5s",
|
||||
"output_directory": "{{ user `output_dir` }}",
|
||||
"vm_name": "{{ user `image_name` }}.img",
|
||||
"headless": true,
|
||||
"qemuargs": [
|
||||
[
|
||||
"-m",
|
||||
"2048"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/partitions.yml",
|
||||
"ansible_env_vars": [
|
||||
"VM_NAME={{ user `vm_name` }}",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY={{ user `HTTPS_PROXY` }}",
|
||||
"http_proxy={{ user `http_proxy` }}",
|
||||
"https_proxy={{ user `https_proxy` }}",
|
||||
"vgname=main",
|
||||
"lvnames=var home",
|
||||
"lvsizes=10%FREE 90%FREE",
|
||||
"lvfssys=ext4 ext4",
|
||||
"lvmntps=/var /home"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [ "reboot" ],
|
||||
"expect_disconnect": true
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/{{ user `module_name` }}.yml",
|
||||
"extra_arguments": [ "--extra-vars", "VM_NAME={{ user `vm_name` }} HTTP_PROXY={{ user `HTTP_PROXY` }} HTTPS_PROXY={{ user `HTTPS_PROXY` }} http_proxy={{ user `http_proxy` }} https_proxy={{ user `https_proxy` }}"]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O qcow2 -c {{ user `output_dir` }}/{{ user `image_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.img",
|
||||
"rm -rf {{ user `output_dir` }}/{{ user `image_name` }}.img"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O vdi {{ user `output_dir` }}/{{ user `vm_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.vdi"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
86
.packer/recipes/eole/2.7.2/zephir.json
Normal file
86
.packer/recipes/eole/2.7.2/zephir.json
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"eole_provisionning": "{{ user `provisionning_dir`}}/eole",
|
||||
"eole_playbooks": "{{ user `provisionning_dir` }}/playbooks/eole",
|
||||
"module_name": "zephir",
|
||||
"ubuntu_version": "18.04",
|
||||
"eole_version": "2.7.2",
|
||||
"vm_name": "{{ user `module_name` }}-2.7.2",
|
||||
"image_size": "40960",
|
||||
"output_dir": "{{ template_dir }}/../../../images/eole/2.7.2/{{ user `module_name` }}",
|
||||
"image_name": "{{ user `vm_name` }}-{{ isotime \"20060102\" }}"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_url": "{{ template_dir }}/../../../images/eole/{{user `eole_version`}}/eolebase/eolebase-{{ user `eole_version` }}.img",
|
||||
"iso_checksum": "none",
|
||||
"disk_image": true,
|
||||
"format": "qcow2",
|
||||
"disk_size": "{{ user `image_size` }}",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"accelerator": "kvm",
|
||||
"net_device": "virtio-net",
|
||||
"disk_interface": "virtio",
|
||||
"ssh_wait_timeout": "5m",
|
||||
"boot_wait": "5s",
|
||||
"output_directory": "{{ user `output_dir` }}",
|
||||
"vm_name": "{{ user `image_name` }}.img",
|
||||
"headless": true,
|
||||
"qemuargs": [
|
||||
[
|
||||
"-m",
|
||||
"2048"
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/partitions.yml",
|
||||
"ansible_env_vars": [
|
||||
"VM_NAME={{ user `vm_name` }}",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY={{ user `HTTPS_PROXY` }}",
|
||||
"http_proxy={{ user `http_proxy` }}",
|
||||
"https_proxy={{ user `https_proxy` }}",
|
||||
"vgname=main",
|
||||
"lvnames=home var",
|
||||
"lvsizes=5%FREE 80%FREE",
|
||||
"lvfssys=ext4 ext4",
|
||||
"lvmntps=/home /var"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [ "reboot" ],
|
||||
"expect_disconnect": true
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"pause_before": "45s",
|
||||
"playbook_file": "{{ user `eole_playbooks` }}/{{ user `module_name` }}.yml",
|
||||
"extra_arguments": [ "--extra-vars", "VM_NAME={{ user `vm_name` }} HTTP_PROXY={{ user `HTTP_PROXY` }} HTTPS_PROXY={{ user `HTTPS_PROXY` }} http_proxy={{ user `http_proxy` }} https_proxy={{ user `https_proxy` }}"]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"inline": [
|
||||
"sleep 5",
|
||||
"qemu-img convert -O qcow2 -c {{ user `output_dir` }}/{{ user `image_name` }}.img {{ user `output_dir` }}/{{ user `vm_name` }}.img",
|
||||
"rm -rf {{ user `output_dir` }}/{{ user `image_name` }}.img"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
117
.packer/recipes/infra/cadoles.com/production/sso.json
Normal file
117
.packer/recipes/infra/cadoles.com/production/sso.json
Normal file
@ -0,0 +1,117 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"domain": "{{ env `DOMAIN` }}",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../../provisioning",
|
||||
"playbooks_dir": "{{ user `provisionning_dir` }}/playbooks",
|
||||
"infra_provisionning": "{{ user `provisionning_dir`}}/infra/{{ user `domain` }}",
|
||||
"infra_playbooks": "{{ user `provisionning_dir` }}/playbooks/infra/{{ user `domain` }}",
|
||||
"vm_name": "{{ env `VM_NAME` }}",
|
||||
"image_output_directory": "{{ template_dir }}/../../../images/infra/cadoles.com/production/{{ user `vm_name`}}/system",
|
||||
"syst_image_file": "{{ user `image_output_directory` }}/{{ user `vm_name` }}.img",
|
||||
"eole_module" : "eolebase",
|
||||
"image_version": "0.0.1",
|
||||
"eole_version" : "2.7.2"
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"type": "qemu",
|
||||
"iso_urls": "{{ template_dir }}/../../../../images/eole/{{user `eole_version`}}/{{user `eole_module`}}/{{user `eole_module`}}-{{ user `eole_version` }}.img",
|
||||
"iso_checksum": "none",
|
||||
"disk_image": true,
|
||||
"format": "qcow2",
|
||||
"cpus": "2",
|
||||
"memory": "2048",
|
||||
"disk_size": "20480",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"accelerator": "kvm",
|
||||
"http_directory": "{{ template_dir }}",
|
||||
"ssh_wait_timeout": "20m",
|
||||
"boot_wait": "15s",
|
||||
"skip_compaction": true,
|
||||
"headless": true,
|
||||
"shutdown_command": "shutdown -P now",
|
||||
"output_directory": "{{ user `image_output_directory` }}",
|
||||
"vm_name": "{{ build_name }}.img"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{user `provisionning_dir`}}/ssh",
|
||||
"destination": "/root/.ssh/"
|
||||
},
|
||||
{
|
||||
"type":"file",
|
||||
"source":"{{ user `provisionning_dir` }}/../provisioning/ssl/ca/",
|
||||
"destination":"/usr/local/share/ca-certificates/rapidssl"
|
||||
},
|
||||
{
|
||||
"type":"file",
|
||||
"source":"{{ user `provisionning_dir` }}/../provisioning/ssl/certs/",
|
||||
"destination":"/etc/ssl/certs/"
|
||||
},
|
||||
{
|
||||
"type":"file",
|
||||
"source":"{{ user `provisionning_dir` }}/../provisioning/ssl/private/",
|
||||
"destination":"/etc/ssl/private/"
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"pause_before": "30s",
|
||||
"playbook_file": "{{ user `playbooks_dir` }}/get_conf_from_zephir.yml",
|
||||
"ansible_env_vars": [
|
||||
"zephir_server=zephir.cadoles.com",
|
||||
"zephir_login=pacer",
|
||||
"zephir_password=9+N7c2#vqV",
|
||||
"create_server=non",
|
||||
"code_rne=00004242",
|
||||
"zephir_id=26",
|
||||
"VM_NAME={{ user `vm_name` }}",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY={{ user `HTTPS_PROXY` }}",
|
||||
"http_proxy={{ user `http_proxy` }}",
|
||||
"https_proxy={{ user `https_proxy` }}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"playbook_file": "{{ user `infra_playbooks` }}/sso.yml",
|
||||
"ansible_env_vars": [
|
||||
"VM_NAME={{user `vm_name`}}",
|
||||
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
||||
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
||||
"http_proxy={{user `http_proxy`}}",
|
||||
"https_proxy={{user `https_proxy`}}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "ansible",
|
||||
"pause_before": "10s",
|
||||
"playbook_file": "{{ user `playbooks_dir` }}/instance.yml",
|
||||
"ansible_env_vars": [
|
||||
"VM_NAME={{ user `vm_name` }}",
|
||||
"HTTP_PROXY={{ user `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY={{ user `HTTPS_PROXY` }}",
|
||||
"http_proxy={{ user `http_proxy` }}",
|
||||
"https_proxy={{ user `https_proxy` }}"
|
||||
]
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"type": "shell-local",
|
||||
"script": "{{ template_dir }}/../../../../post-processors/compress-qcow2.sh",
|
||||
"execute_command": [
|
||||
"/bin/bash",
|
||||
"-c",
|
||||
"{{.Vars}} {{.Script}} {{ user `image_output_directory` }}/../ {{ user `vm_name` }} {{ user `image_version` }}"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
174
.packer/recipes/ubuntu/18.04/http/preseed-minimal.cfg
Normal file
174
.packer/recipes/ubuntu/18.04/http/preseed-minimal.cfg
Normal file
@ -0,0 +1,174 @@
|
||||
### Preseed for Ubuntu 18.04
|
||||
# Derived from: https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
|
||||
|
||||
### Compatibility
|
||||
# Tested with the netboot image:
|
||||
# http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso
|
||||
# Might work with the regular image (not tested):
|
||||
# http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04-server-amd64.iso
|
||||
|
||||
### Authentication
|
||||
# We recommend to use public key authentication and therefore disabled the root
|
||||
# password. The build-iso.sh script will do all the hard work for you.
|
||||
#
|
||||
# In case you still want to use password authentication, you need to set the
|
||||
# passwd/root-password-crypted variable. See below for further instructions.
|
||||
|
||||
### Usage
|
||||
# We recommend to use the build-iso.sh script to build an image with embedded
|
||||
# preseed and other required files. In that case the preseed file gets loaded
|
||||
# automatically and all additional files are available to the installer.
|
||||
#
|
||||
# In case you want to use a vanilla ISO image, please use the following boot
|
||||
# instructions to load the preseed file (press ESC and enter in boot prompt):
|
||||
#
|
||||
# install auto=true priority=critical url=https://raw.githubusercontent.com/core-process/linux-unattended-installation/master/ubuntu/18.04/custom/preseed.cfg
|
||||
#
|
||||
# Note: you will need to adjust the "preseed/late_command" variable to match
|
||||
# your environment in case you do not use the build-iso.sh script.
|
||||
|
||||
|
||||
### Unattended Installation
|
||||
d-i auto-install/enable boolean true
|
||||
d-i debconf/priority select critical
|
||||
|
||||
### Localization
|
||||
d-i debian-installer/locale string fr_FR.UTF-8
|
||||
d-i localechooser/supported-locales multiselect en_US.UTF-8, fr_FR.UTF-8
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/xkb-keymap select fr
|
||||
|
||||
### Network configuration
|
||||
d-i netcfg/choose_interface select auto
|
||||
d-i netcfg/hostname string ubt1804
|
||||
d-i netcfg/get_hostname string ubt1804
|
||||
d-i netcfg/get_domain string cadol.es
|
||||
d-i hw-detect/load_firmware boolean true
|
||||
|
||||
### Mirror settings
|
||||
d-i mirror/country string manual
|
||||
d-i mirror/http/hostname string archive.ubuntu.com
|
||||
d-i mirror/http/directory string /ubuntu
|
||||
d-i mirror/http/proxy string
|
||||
|
||||
### Account setup
|
||||
d-i passwd/root-login boolean true
|
||||
d-i passwd/root-password-crypted password $1$41q22ku0$lM57h3xPuGwoiBHD4Neqg.
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
# The root password is disabled by default. In case you want to use a root
|
||||
# password, please generate a password with the following command
|
||||
# printf "please-change-password" | mkpasswd -s -m sha-512
|
||||
# and update the passwd/root-password-crypted variable accordingly. Furthermore
|
||||
# you need to remove the call to "usermod" below.
|
||||
|
||||
### Normal account setup
|
||||
d-i passwd/user-fullname string Cadoles User
|
||||
d-i passwd/username string cadoles
|
||||
d-i passwd/user-password-crypted password $1$41q22ku0$lM57h3xPuGwoiBHD4Neqg.
|
||||
d-i passwd/user-uid string 1000
|
||||
d-i passwd/user-default-groups string wheel
|
||||
|
||||
### Clock and time zone setup
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Europe/Paris
|
||||
d-i clock-setup/ntp boolean true
|
||||
d-i clock-setup/ntp-server string ntp.ubuntu.com
|
||||
|
||||
### Partitioning
|
||||
d-i preseed/early_command string umount /media || true
|
||||
d-i partman-auto/disk string /dev/vda
|
||||
d-i partman-auto/method string lvm
|
||||
d-i partman-auto-lvm/guided_size string max
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-lvm/confirm boolean true
|
||||
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||
d-i partman-auto-lvm/new_vg_name string main
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
d-i partman-md/confirm boolean true
|
||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
d-i partman-basicmethods/method_only boolean false
|
||||
|
||||
### GPT
|
||||
d-i partman-basicfilesystems/choose_label string gpt
|
||||
d-i partman-basicfilesystems/default_label string gpt
|
||||
d-i partman-partitioning/choose_label string gpt
|
||||
d-i partman-partitioning/default_label string gpt
|
||||
d-i partman/choose_label string gpt
|
||||
d-i partman/default_label string gpt
|
||||
|
||||
### EFI
|
||||
d-i partman-efi/non_efi_system boolean true
|
||||
|
||||
### Grub
|
||||
d-i grub-installer/bootdev string /dev/vda
|
||||
d-i grub-installer/only_debian boolean true
|
||||
d-i grub-installer/with_other_os boolean true
|
||||
|
||||
### Disk layout
|
||||
|
||||
# Use entire disk
|
||||
d-i partman-auto/expert_recipe string \
|
||||
boot-root :: \
|
||||
1 1 1 free \
|
||||
$bios_boot{ } \
|
||||
method{ biosgrub } \
|
||||
. \
|
||||
256 256 256 fat32 \
|
||||
$primary{ } \
|
||||
$iflabel{ gpt } \
|
||||
$reusemethod{ } \
|
||||
method{ efi } format{ } \
|
||||
mountpoint{ /boot/efi } \
|
||||
. \
|
||||
512 512 512 ext4 \
|
||||
$primary{ } \
|
||||
$bootable{ } \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext4 } \
|
||||
mountpoint{ /boot } \
|
||||
. \
|
||||
1024 102400000 1000000000 ext4 \
|
||||
$lvmok{ } \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext4 } \
|
||||
mountpoint{ / } \
|
||||
lv_name{ root } \
|
||||
. \
|
||||
200% 200% 200% linux-swap \
|
||||
$lvmok{ } \
|
||||
method{ swap } format{ } \
|
||||
lv_name{ swap } \
|
||||
.
|
||||
|
||||
### Base system installation
|
||||
d-i base-installer/install-recommends boolean true
|
||||
d-i base-installer/kernel/image string linux-generic
|
||||
|
||||
### Apt setup
|
||||
d-i apt-setup/restricted boolean true
|
||||
d-i apt-setup/universe boolean true
|
||||
d-i apt-setup/backports boolean true
|
||||
d-i apt-setup/use_mirror boolean false
|
||||
d-i apt-setup/services-select multiselect security, updates
|
||||
d-i apt-setup/security_host string security.ubuntu.com
|
||||
d-i apt-setup/security_path string /ubuntu
|
||||
|
||||
### Package selection
|
||||
d-i tasksel/first multiselect none
|
||||
d-i pkgsel/include string openssh-server python
|
||||
d-i pkgsel/upgrade select full-upgrade
|
||||
d-i pkgsel/update-policy select unattended-upgrades
|
||||
|
||||
### Finishing up the installation
|
||||
d-i preseed/late_command string \
|
||||
in-target sh -c "sed -i '/PermitRootLogin/c PermitRootLogin yes' /etc/ssh/sshd_config"; \
|
||||
in-target sh -c 'echo "IPv4: \\\4" >> /etc/issue && echo "IPv6: \\\6" >> /etc/issue && echo "" >> /etc/issue';
|
||||
d-i debian-installer/splash boolean false
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
### Shutdown machine
|
||||
d-i finish-install/reboot_in_progress note
|
71
.packer/recipes/ubuntu/18.04/packer.json
Normal file
71
.packer/recipes/ubuntu/18.04/packer.json
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"vm_name": "ubuntu-18.04",
|
||||
"packer_images_output_dir": "{{ template_dir }}/../../../images/ubuntu/18.04",
|
||||
"cpus": "2",
|
||||
"memory": "4096",
|
||||
"ubuntu_codename": "bionic",
|
||||
"ubuntu_mirror": "http://archive.ubuntu.com/ubuntu/dists/",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"preseed_file_name": "preseed-minimal.cfg",
|
||||
"disk_size": "10240",
|
||||
"headless": "true"
|
||||
},
|
||||
|
||||
"builders":
|
||||
[
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"vm_name": "{{ user `vm_name` }}.img",
|
||||
"type": "qemu",
|
||||
"iso_checksum": "file:{{ user `ubuntu_mirror` }}{{ user `ubuntu_codename` }}-updates/main/installer-amd64/current/images/SHA256SUMS",
|
||||
"iso_urls": [ "{{ user `ubuntu_mirror` }}{{ user `ubuntu_codename` }}-updates/main/installer-amd64/current/images/netboot/mini.iso" ],
|
||||
"ssh_username": "{{ user `ssh_username` }}",
|
||||
"ssh_password": "{{ user `ssh_password` }}",
|
||||
"vnc_bind_address": "0.0.0.0",
|
||||
"ssh_wait_timeout": "60m",
|
||||
"headless": "{{ user `headless` }}",
|
||||
"output_directory": "{{ template_dir }}/../../../images/ubuntu/18.04",
|
||||
"accelerator": "kvm",
|
||||
"cpus": "{{ user `cpus` }}",
|
||||
"memory": "{{user `memory`}}",
|
||||
"boot_wait": "5s",
|
||||
"boot_command":
|
||||
[
|
||||
"<tab>",
|
||||
"url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{ user `preseed_file_name` }} ",
|
||||
"auto=true ",
|
||||
"language=fr ",
|
||||
"country=FR ",
|
||||
"locale=fr_FR.UTF-8 ",
|
||||
"method=fr ",
|
||||
"net.ifnames=0 ",
|
||||
"hostname={{user `vm_name` }} ",
|
||||
"<enter>"
|
||||
],
|
||||
"disk_size": "{{ user `disk_size` }}",
|
||||
"disk_additional_size": [ "10G", "20G", "30G", "40G", "50G", "60G" ],
|
||||
"http_directory": "{{template_dir}}/http"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts": [
|
||||
"{{ template_dir }}/scripts/provision-minimal.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
"VM_NAME={{user `vm_name`}}",
|
||||
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
||||
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
||||
"http_proxy={{user `http_proxy`}}",
|
||||
"https_proxy={{user `https_proxy`}}"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
59
.packer/recipes/ubuntu/18.04/scripts/provision-minimal.sh
Normal file
59
.packer/recipes/ubuntu/18.04/scripts/provision-minimal.sh
Normal file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
# For SHASUM
|
||||
apt-get -y install perl ifupdown
|
||||
|
||||
# Download OpenNebula context package
|
||||
ONE_CONTEXT_VERSION=5.8.0
|
||||
ONE_CONTEXT_BUILD_SUFFIX=-1
|
||||
ONE_CONTEXT_SHASUM=cfcc8aa2e51396935e8d2a507f996838201515b5
|
||||
ONE_CONTEXT_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v${ONE_CONTEXT_VERSION}/one-context_${ONE_CONTEXT_VERSION}${ONE_CONTEXT_BUILD_SUFFIX}.deb"
|
||||
ONE_CONTEXT_PACKAGE_DEST=/tmp/one-context.deb
|
||||
|
||||
wget -O- "${ONE_CONTEXT_URL}" > "${ONE_CONTEXT_PACKAGE_DEST}"
|
||||
echo "${ONE_CONTEXT_SHASUM} ${ONE_CONTEXT_PACKAGE_DEST}" | shasum -c
|
||||
|
||||
# Purge cloud-init
|
||||
apt-get purge -y cloud-init perl
|
||||
|
||||
# Install onecontext
|
||||
dpkg -i "${ONE_CONTEXT_PACKAGE_DEST}" || apt-get install -fy
|
||||
|
||||
# Update hostname
|
||||
hostnamectl set-hostname "${VM_NAME}"
|
||||
|
||||
# Disable root login with password
|
||||
# sed -i 's/^PermitRootLogin.*$/PermitRootLogin without-password/' /etc/ssh/sshd_config
|
||||
|
||||
# Run dhclient on one-context service failure
|
||||
mkdir -p /etc/systemd/system/one-context.service.d
|
||||
cat > /etc/systemd/system/one-context.service.d/dhclient-on-fail.conf <<EOF
|
||||
[Unit]
|
||||
OnFailure=one-dhclient.service
|
||||
EOF
|
||||
|
||||
cat > /etc/systemd/system/one-dhclient.service <<EOF
|
||||
[Unit]
|
||||
Description=Execute dhclient
|
||||
|
||||
[Service]
|
||||
ExecStart=/sbin/dhclient
|
||||
EOF
|
||||
chmod 664 /etc/systemd/system/one-dhclient.service
|
||||
|
||||
# Disable auto-upgrade
|
||||
systemctl disable unattended-upgrades
|
||||
systemctl disable apt-daily
|
||||
systemctl disable apt-daily.timer
|
||||
systemctl disable apt-daily-upgrade
|
||||
|
||||
apt-get install -y qemu-guest-agent
|
||||
|
||||
# Cleanup
|
||||
rm -f "${ONE_CONTEXT_PACKAGE_DEST}"
|
||||
apt-get -y clean
|
||||
|
||||
# Force sync
|
||||
sync
|
174
.packer/recipes/ubuntu/20.04/http/preseed-minimal.cfg
Normal file
174
.packer/recipes/ubuntu/20.04/http/preseed-minimal.cfg
Normal file
@ -0,0 +1,174 @@
|
||||
### Preseed for Ubuntu 18.04
|
||||
# Derived from: https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
|
||||
|
||||
### Compatibility
|
||||
# Tested with the netboot image:
|
||||
# http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso
|
||||
# Might work with the regular image (not tested):
|
||||
# http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04-server-amd64.iso
|
||||
|
||||
### Authentication
|
||||
# We recommend to use public key authentication and therefore disabled the root
|
||||
# password. The build-iso.sh script will do all the hard work for you.
|
||||
#
|
||||
# In case you still want to use password authentication, you need to set the
|
||||
# passwd/root-password-crypted variable. See below for further instructions.
|
||||
|
||||
### Usage
|
||||
# We recommend to use the build-iso.sh script to build an image with embedded
|
||||
# preseed and other required files. In that case the preseed file gets loaded
|
||||
# automatically and all additional files are available to the installer.
|
||||
#
|
||||
# In case you want to use a vanilla ISO image, please use the following boot
|
||||
# instructions to load the preseed file (press ESC and enter in boot prompt):
|
||||
#
|
||||
# install auto=true priority=critical url=https://raw.githubusercontent.com/core-process/linux-unattended-installation/master/ubuntu/18.04/custom/preseed.cfg
|
||||
#
|
||||
# Note: you will need to adjust the "preseed/late_command" variable to match
|
||||
# your environment in case you do not use the build-iso.sh script.
|
||||
|
||||
|
||||
### Unattended Installation
|
||||
d-i auto-install/enable boolean true
|
||||
d-i debconf/priority select critical
|
||||
|
||||
### Localization
|
||||
d-i debian-installer/locale string fr_FR.UTF-8
|
||||
d-i localechooser/supported-locales multiselect en_US.UTF-8, fr_FR.UTF-8
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i keyboard-configuration/xkb-keymap select fr
|
||||
|
||||
### Network configuration
|
||||
d-i netcfg/choose_interface select auto
|
||||
d-i netcfg/hostname string ubt2004
|
||||
d-i netcfg/get_hostname string ubt2004
|
||||
d-i netcfg/get_domain string cadol.es
|
||||
d-i hw-detect/load_firmware boolean true
|
||||
|
||||
### Mirror settings
|
||||
d-i mirror/country string manual
|
||||
d-i mirror/http/hostname string archive.ubuntu.com
|
||||
d-i mirror/http/directory string /ubuntu
|
||||
d-i mirror/http/proxy string
|
||||
|
||||
### Account setup
|
||||
d-i passwd/root-login boolean true
|
||||
d-i passwd/root-password-crypted password $1$41q22ku0$lM57h3xPuGwoiBHD4Neqg.
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
# The root password is disabled by default. In case you want to use a root
|
||||
# password, please generate a password with the following command
|
||||
# printf "please-change-password" | mkpasswd -s -m sha-512
|
||||
# and update the passwd/root-password-crypted variable accordingly. Furthermore
|
||||
# you need to remove the call to "usermod" below.
|
||||
|
||||
### Normal account setup
|
||||
d-i passwd/user-fullname string Cadoles User
|
||||
d-i passwd/username string cadoles
|
||||
d-i passwd/user-password-crypted password $1$41q22ku0$lM57h3xPuGwoiBHD4Neqg.
|
||||
d-i passwd/user-uid string 1000
|
||||
d-i passwd/user-default-groups string wheel
|
||||
|
||||
### Clock and time zone setup
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string Europe/Paris
|
||||
d-i clock-setup/ntp boolean true
|
||||
d-i clock-setup/ntp-server string ntp.ubuntu.com
|
||||
|
||||
### Partitioning
|
||||
d-i preseed/early_command string umount /media || true
|
||||
d-i partman-auto/disk string /dev/vda
|
||||
d-i partman-auto/method string lvm
|
||||
d-i partman-auto-lvm/guided_size string max
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-lvm/confirm boolean true
|
||||
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||
d-i partman-auto-lvm/new_vg_name string main
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
d-i partman-md/confirm boolean true
|
||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
d-i partman-basicmethods/method_only boolean false
|
||||
|
||||
### GPT
|
||||
d-i partman-basicfilesystems/choose_label string gpt
|
||||
d-i partman-basicfilesystems/default_label string gpt
|
||||
d-i partman-partitioning/choose_label string gpt
|
||||
d-i partman-partitioning/default_label string gpt
|
||||
d-i partman/choose_label string gpt
|
||||
d-i partman/default_label string gpt
|
||||
|
||||
### EFI
|
||||
d-i partman-efi/non_efi_system boolean true
|
||||
|
||||
### Grub
|
||||
d-i grub-installer/bootdev string /dev/vda
|
||||
d-i grub-installer/only_debian boolean true
|
||||
d-i grub-installer/with_other_os boolean true
|
||||
|
||||
### Disk layout
|
||||
|
||||
# Use entire disk
|
||||
d-i partman-auto/expert_recipe string \
|
||||
boot-root :: \
|
||||
1 1 1 free \
|
||||
$bios_boot{ } \
|
||||
method{ biosgrub } \
|
||||
. \
|
||||
256 256 256 fat32 \
|
||||
$primary{ } \
|
||||
$iflabel{ gpt } \
|
||||
$reusemethod{ } \
|
||||
method{ efi } format{ } \
|
||||
mountpoint{ /boot/efi } \
|
||||
. \
|
||||
512 512 512 ext4 \
|
||||
$primary{ } \
|
||||
$bootable{ } \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext4 } \
|
||||
mountpoint{ /boot } \
|
||||
. \
|
||||
1024 102400000 1000000000 ext4 \
|
||||
$lvmok{ } \
|
||||
method{ format } format{ } \
|
||||
use_filesystem{ } filesystem{ ext4 } \
|
||||
mountpoint{ / } \
|
||||
lv_name{ root } \
|
||||
. \
|
||||
200% 200% 200% linux-swap \
|
||||
$lvmok{ } \
|
||||
method{ swap } format{ } \
|
||||
lv_name{ swap } \
|
||||
.
|
||||
|
||||
### Base system installation
|
||||
d-i base-installer/install-recommends boolean true
|
||||
d-i base-installer/kernel/image string linux-generic
|
||||
|
||||
### Apt setup
|
||||
d-i apt-setup/restricted boolean true
|
||||
d-i apt-setup/universe boolean true
|
||||
d-i apt-setup/backports boolean true
|
||||
d-i apt-setup/use_mirror boolean false
|
||||
d-i apt-setup/services-select multiselect security, updates
|
||||
d-i apt-setup/security_host string security.ubuntu.com
|
||||
d-i apt-setup/security_path string /ubuntu
|
||||
|
||||
### Package selection
|
||||
d-i tasksel/first multiselect none
|
||||
d-i pkgsel/include string openssh-server python
|
||||
d-i pkgsel/upgrade select full-upgrade
|
||||
d-i pkgsel/update-policy select unattended-upgrades
|
||||
|
||||
### Finishing up the installation
|
||||
d-i preseed/late_command string \
|
||||
in-target sh -c "sed -i '/PermitRootLogin/c PermitRootLogin yes' /etc/ssh/sshd_config"; \
|
||||
in-target sh -c 'echo "IPv4: \\\4" >> /etc/issue && echo "IPv6: \\\6" >> /etc/issue && echo "" >> /etc/issue';
|
||||
d-i debian-installer/splash boolean false
|
||||
d-i cdrom-detect/eject boolean true
|
||||
|
||||
### Shutdown machine
|
||||
d-i finish-install/reboot_in_progress note
|
72
.packer/recipes/ubuntu/20.04/packer.json
Normal file
72
.packer/recipes/ubuntu/20.04/packer.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"variables": {
|
||||
"HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
|
||||
"HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
|
||||
"http_proxy": "{{ env `http_proxy` }}",
|
||||
"https_proxy": "{{ env `https_proxy` }}",
|
||||
"packer_images_output_dir": "{{ template_dir }}/../../../images/ubuntu/20.04",
|
||||
"provisionning_dir": "{{ template_dir }}/../../../provisioning",
|
||||
"cpus": "2",
|
||||
"memory": "4096",
|
||||
"ubuntu_codename": "focal",
|
||||
"ubuntu_version": "20.04",
|
||||
"ubuntu_mirror": "http://archive.ubuntu.com/ubuntu/dists/",
|
||||
"ssh_username": "root",
|
||||
"ssh_password": "cadoles",
|
||||
"preseed_file_name": "preseed-minimal.cfg",
|
||||
"disk_size": "10240",
|
||||
"headless": "true",
|
||||
"vm_name": "ubuntu-{{ user `ubuntu_version` }}"
|
||||
},
|
||||
|
||||
"builders":
|
||||
[
|
||||
{
|
||||
"name": "{{ user `vm_name` }}",
|
||||
"vm_name": "{{ user `vm_name` }}.img",
|
||||
"type": "qemu",
|
||||
"iso_checksum": "file:{{ user `ubuntu_mirror` }}{{ user `ubuntu_codename` }}-updates/main/installer-amd64/current/legacy-images/SHA256SUMS",
|
||||
"iso_urls": [ "{{ user `ubuntu_mirror` }}{{ user `ubuntu_codename` }}-updates/main/installer-amd64/current/legacy-images/netboot/mini.iso" ],
|
||||
"ssh_username": "{{ user `ssh_username` }}",
|
||||
"ssh_password": "{{ user `ssh_password` }}",
|
||||
"ssh_wait_timeout": "60m",
|
||||
"headless": "{{ user `headless` }}",
|
||||
"output_directory": "{{ template_dir }}/../../../images/ubuntu/20.04",
|
||||
"accelerator": "kvm",
|
||||
"cpus": "{{ user `cpus` }}",
|
||||
"memory": "{{user `memory`}}",
|
||||
"boot_wait": "5s",
|
||||
"boot_command":
|
||||
[
|
||||
"<tab>",
|
||||
"url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{ user `preseed_file_name` }} ",
|
||||
"auto=true ",
|
||||
"language=fr ",
|
||||
"country=FR ",
|
||||
"locale=fr_FR.UTF-8 ",
|
||||
"method=fr ",
|
||||
"net.ifnames=0 ",
|
||||
"hostname={{user `vm_name` }} ",
|
||||
"<enter>"
|
||||
],
|
||||
"disk_size": "{{ user `disk_size` }}",
|
||||
"disk_additional_size": [ "10G", "20G", "30G", "40G", "50G", "60G" ],
|
||||
"http_directory": "{{template_dir}}/http"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts": [
|
||||
"{{ user `provisionning_dir` }}/ubuntu/{{ user `ubuntu_version` }}/provision-minimal.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
"VM_NAME={{user `vm_name`}}",
|
||||
"HTTP_PROXY={{user `HTTP_PROXY`}}",
|
||||
"HTTPS_PROXY={{user `HTTPS_PROXY`}}",
|
||||
"http_proxy={{user `http_proxy`}}",
|
||||
"https_proxy={{user `https_proxy`}}"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
57
.packer/recipes/ubuntu/20.04/scripts/provision-minimal.sh
Normal file
57
.packer/recipes/ubuntu/20.04/scripts/provision-minimal.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
set -xeo pipefail
|
||||
|
||||
# For SHASUM
|
||||
apt-get -y install perl ifupdown
|
||||
|
||||
# Download OpenNebula context package
|
||||
ONE_CONTEXT_VERSION=5.8.0
|
||||
ONE_CONTEXT_BUILD_SUFFIX=-1
|
||||
ONE_CONTEXT_SHASUM=cfcc8aa2e51396935e8d2a507f996838201515b5
|
||||
ONE_CONTEXT_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v${ONE_CONTEXT_VERSION}/one-context_${ONE_CONTEXT_VERSION}${ONE_CONTEXT_BUILD_SUFFIX}.deb"
|
||||
ONE_CONTEXT_PACKAGE_DEST=/tmp/one-context.deb
|
||||
|
||||
wget -O- "${ONE_CONTEXT_URL}" > "${ONE_CONTEXT_PACKAGE_DEST}"
|
||||
echo "${ONE_CONTEXT_SHASUM} ${ONE_CONTEXT_PACKAGE_DEST}" | shasum -c
|
||||
|
||||
# Purge cloud-init
|
||||
apt-get purge -y cloud-init perl
|
||||
|
||||
# Install onecontext
|
||||
dpkg -i "${ONE_CONTEXT_PACKAGE_DEST}" || apt-get install -fy
|
||||
|
||||
# Update hostname
|
||||
hostnamectl set-hostname "${VM_NAME}"
|
||||
|
||||
# Disable root login with password
|
||||
# sed -i 's/^PermitRootLogin.*$/PermitRootLogin without-password/' /etc/ssh/sshd_config
|
||||
|
||||
# Run dhclient on one-context service failure
|
||||
mkdir -p /etc/systemd/system/one-context.service.d
|
||||
cat > /etc/systemd/system/one-context.service.d/dhclient-on-fail.conf <<EOF
|
||||
[Unit]
|
||||
OnFailure=one-dhclient.service
|
||||
EOF
|
||||
|
||||
cat > /etc/systemd/system/one-dhclient.service <<EOF
|
||||
[Unit]
|
||||
Description=Execute dhclient
|
||||
|
||||
[Service]
|
||||
ExecStart=/sbin/dhclient
|
||||
EOF
|
||||
chmod 664 /etc/systemd/system/one-dhclient.service
|
||||
|
||||
# Disable auto-upgrade
|
||||
systemctl disable unattended-upgrades
|
||||
systemctl disable apt-daily
|
||||
systemctl disable apt-daily.timer
|
||||
systemctl disable apt-daily-upgrade
|
||||
|
||||
# Cleanup
|
||||
rm -f "${ONE_CONTEXT_PACKAGE_DEST}"
|
||||
apt-get -y clean
|
||||
|
||||
# Force sync
|
||||
sync
|
Reference in New Issue
Block a user