Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 088284d8 authored by Yves Delnondedieu's avatar Yves Delnondedieu
Browse files

Initial commit

parents
# Never modify line endings of our bash scripts
*.sh -crlf
*.json -crlf
answers -crlf
# Cache objects
packer_cache/
# Output
output-virtualbox-iso/
# For built boxes
*.box
MIT License
Copyright (c) 2018 Ron Valente
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# alpine-openstack-image
Alpine Linux OpenStack VM Image
## Prerequisites
Install Packer: https://www.packer.io/intro/getting-started/install.html
## Getting Started
```
packer build alpine.json
qemu-img convert -f vmdk -O raw output-virtualbox-iso/alpine38-disk001.vmdk output-virtualbox-iso/alpine38-disk001.raw
openstack image create --file output-virtualbox-iso/alpine38-disk001.raw --disk-format raw --container-format bare alpine38
```
## Ajout
Sur la base de https://github.com/rvalente/alpine-openstack-image
MAJ de la version Alpine 3.13, clavier Français, pas de docker, configuration de sshd
{
"builders": [
{
"boot_command": [
"root<enter><wait>",
"ifconfig eth0 up \u0026\u0026 udhcpc -i eth0<enter><wait5>",
"wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/answers<enter><wait>",
"setup-alpine -f answers<enter><wait5>",
"{{user `root_pw`}}<enter><wait>",
"{{user `root_pw`}}<enter><wait5>",
"<wait>y<enter><wait10>",
"rc-service sshd stop<enter>",
"mount /dev/vg0/lv_root /mnt<enter>",
"echo 'PermitRootLogin yes' >> /mnt/etc/ssh/sshd_config<enter>",
"umount /mnt<enter>",
"reboot<enter>"
],
"disk_size": "{{user `disk`}}",
"guest_additions_mode": "disable",
"guest_os_type": "Linux26_64",
"http_directory": "http",
"iso_checksum": "file:https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-virt-3.13.2-x86_64.iso.sha256",
"iso_url": "https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-virt-3.13.2-x86_64.iso",
"shutdown_command": "/sbin/poweroff",
"ssh_password": "{{user `root_pw`}}",
"ssh_username": "root",
"type": "virtualbox-iso",
"vboxmanage": [
[
"modifyvm",
"{{ .Name }}",
"--memory",
"{{ user `mem`}}"
],
[
"modifyvm",
"{{ .Name }}",
"--cpus",
"{{user `cpus`}}"
]
],
"vm_name": "alpine3"
}
],
"provisioners": [
{
"override": {
"virtualbox-iso": {
"execute_command": "/bin/sh '{{ .Path }}'"
}
},
"scripts": [
"scripts/00_base.sh",
"scripts/01_openstack.sh",
"scripts/02_keymap_fr.sh",
"scripts/99_cleanup.sh"
],
"type": "shell"
}
],
"variables": {
"cpus": "1",
"disk": "4096",
"mem": "256",
"root_pw": "root",
"ssh_pass": "mPRMAUnJtT2XBBCKh2xw",
"ssh_user": "alpine"
}
}
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine3"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
"
DNSOPTS="-n 8.8.8.8"
TIMEZONEOPTS="-z Europe/Paris"
PROXYOPTS="none"
APKREPOSOPTS="-1"
SSHDOPTS="-c openssh"
NTPOPTS="-c chrony"
DISKOPTS="-L -m sys /dev/sda"
set -ux
sed -i -e 's/#//g' /etc/apk/repositories
sed -i -e '1d' /etc/apk/repositories
# Upgrade All Packages in OneShot
apk upgrade --update-cache --available
# Install sudo
apk add sudo
# Configure a colored prompt
cat >/etc/profile.d/color_prompt.sh <<'EOF'
N="\[\e[0m\]"
R="\[\e[1;31m\]"
G="\[\e[1;32m\]"
B="\[\e[1;34m\]"
if [ "$USER" = root ]
then
PS1="$B\u@\h:$N\w\ $R\\\$ $N"
else
PS1="$B\u@\h:$N\w $G\$ $N"
fi
EOF
# Update MOTD
cat << EOF > /etc/motd
Alpine Linux for OpenStack
EOF
set -ux
apk add cloud-init
apk add acpi
# Start Cloud-Init on Boot
rc-update add cloud-init default
sed -e '/ssh_pwauth:/ s/0/no/' \
-e '/name: alpine/a \ passwd: $6$o64phlSdQ9qSrDmF$dL8O1A6qHy337RDzCoh8ojJjoGkkxEsxezL6/wqnOs80q5bPC7q.hfUVbkb8yXj6DYWZfBo2jOhJZiEJVIveA.' \
-e '/lock_passwd:/ s/True/False/' \
-i /etc/cloud/cloud.cfg
set -ux
setup-keymap fr fr
set -ux
# Disable Root SSH Login
sed -e '/PermitRootLogin yes/d' \
-e 's/^#PasswordAuthentication yes/PasswordAuthentication no/' \
-e 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/' \
-i /etc/ssh/sshd_config
# Fill Disk with Zeros
dd if=/dev/zero of=/EMPTY bs=1M
# Remove Zeroes
rm -f /EMPTY
# Block until the empty file has been removed, otherwise, Packer
# will try to kill the box while the disk is still full and that's bad
sync
sync
sync
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment