mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Use packer to create a base preconfigured base image
This commit is contained in:
parent
3090cc6818
commit
3731d10987
12 changed files with 153 additions and 68 deletions
58
packer/packer.json
Normal file
58
packer/packer.json
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"variables": {
|
||||
"api_access_key": "{{ env `SCALEWAY_ORGANIZATION` }}",
|
||||
"api_token": "{{ env `SCALEWAY_TOKEN` }}",
|
||||
"vault_pass_file": ""
|
||||
},
|
||||
"builders": [
|
||||
{
|
||||
"type": "scaleway",
|
||||
"api_access_key": "{{ user `api_access_key` }}",
|
||||
"api_token": "{{ user `api_token` }}",
|
||||
"server_name": "k8s-template",
|
||||
"image_name": "ubuntu-bionic-k8s",
|
||||
"snapshot_name": "ubuntu-bionic-k8s-snapshot",
|
||||
"image": "d4067cdc-dc9d-4810-8a26-0dae51d7df42",
|
||||
"region": "par1",
|
||||
"commercial_type": "START1-S",
|
||||
"ssh_username": "root"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"sleep 30",
|
||||
"apt -y update",
|
||||
"DEBIAN_FRONTEND=noninteractive apt-get -y upgrade",
|
||||
"apt -y install software-properties-common",
|
||||
"apt-add-repository ppa:ansible/ansible",
|
||||
"apt -y update",
|
||||
"apt -y install ansible"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{ user `vault_pass_file` }}",
|
||||
"destination": "/tmp/vault-pass"
|
||||
},
|
||||
{
|
||||
"type": "ansible-local",
|
||||
"role_paths": "../roles/docker",
|
||||
"group_vars": "../group_vars",
|
||||
"clean_staging_directory": true,
|
||||
"playbook_file": "common.yml",
|
||||
"extra_arguments": "--vault-password-file=/tmp/vault-pass"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"rm -f /tmp/vault-pass",
|
||||
"apt -y remove --purge ansible",
|
||||
"apt-add-repository --remove ppa:ansible/ansible",
|
||||
"apt autoremove -y",
|
||||
"apt update"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue