-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_packer_environment.sh
executable file
·36 lines (29 loc) · 1.19 KB
/
create_packer_environment.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
PACKER_ENV_DIR="../packer-env"
PACKER_PROJECT_DIR_NAME="packer-ansible"
mkdir -p \
${PACKER_ENV_DIR}/debian/10/ \
${PACKER_ENV_DIR}/debian/11/ \
${PACKER_ENV_DIR}/debian/12 \
${PACKER_ENV_DIR}/ansible \
${PACKER_ENV_DIR}/ansible/roles \
${PACKER_ENV_DIR}/inventory \
${PACKER_ENV_DIR}/inventory/group_vars \
${PACKER_ENV_DIR}/inventory/host_vars
cd ${PACKER_ENV_DIR}
PACKER_ENV_DIR=`pwd`
ln -sf ../${PACKER_PROJECT_DIR_NAME}/base.pkr.hcl .
if ! test -f ${PACKER_ENV_DIR}/custom.auto.pkrvars.hcl; then
cp ../${PACKER_PROJECT_DIR_NAME}/custom.auto.pkrvars.hcl.dist custom.auto.pkrvars.hcl
fi
cd ${PACKER_ENV_DIR}/ansible
ln -sf ../../${PACKER_PROJECT_DIR_NAME}/ansible/base_playbook.yml .
cd ${PACKER_ENV_DIR}/debian/10
ln -sf ../../../${PACKER_PROJECT_DIR_NAME}/debian/10/base .
ln -sf ../../../${PACKER_PROJECT_DIR_NAME}/debian/10/base_cloud .
cd ${PACKER_ENV_DIR}/debian/11
ln -sf ../../../${PACKER_PROJECT_DIR_NAME}/debian/11/base .
ln -sf ../../../${PACKER_PROJECT_DIR_NAME}/debian/11/base_cloud .
cd ${PACKER_ENV_DIR}/debian/12
ln -sf ../../../${PACKER_PROJECT_DIR_NAME}/debian/12/base .
ln -sf ../../../${PACKER_PROJECT_DIR_NAME}/debian/12/base_cloud .