Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cloud-init capability for Ubuntu #2

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
cfb7e20
add cloud init ability for ubunut. Fix issues when setting hostname/u…
windrad6 Nov 27, 2021
0e72923
Changed create_image.sh
vincent-bareiss Dec 22, 2021
cc6e0fd
flash iamge script
Jan 7, 2022
0f3ae46
Flash image script and support for branches
vincent-bareiss Jan 9, 2022
0b5daaa
Fix branch and access token options
vincent-bareiss Jan 9, 2022
6d8727f
Changed vault pass generation
vincent-bareiss Jan 9, 2022
33b2f6e
Add automatic vault decryption
vincent-bareiss Jan 9, 2022
19a4b16
Rename flash_image to update image
vincent-bareiss Jan 12, 2022
d5e661f
Add git options
vincent-bareiss Jan 12, 2022
5d31615
Added git
vincent-bareiss Jan 17, 2022
cab9cb5
WIP: encrypting files with vaul
vincent-bareiss Jan 17, 2022
da224c0
Add password store and GPG
vincent-bareiss Jan 26, 2022
e5ab674
replace tab with 2 spaces
vincent-bareiss Jan 26, 2022
d3ed475
changed how vault passwords are created/handeled
vincent-bareiss Jan 26, 2022
6512bf4
various fixes
stv0g Jan 31, 2022
169b4e2
Update Readme
vincent-bareiss Feb 1, 2022
2e12022
Change acslab to openvpn and make ovpn+snmp opt
vincent-bareiss Feb 14, 2022
b8c36a2
Add dependency checks
vincent-bareiss Feb 14, 2022
fadb7b1
Fix wrong setting dialog
vincent-bareiss Feb 14, 2022
3bde8a1
fix small errors
vincent-bareiss Feb 14, 2022
f0fc2eb
add docker functionality
vincent-bareiss Feb 15, 2022
dd75d85
small fixes
windrad6 Feb 16, 2022
e40be71
strip color bytes from pass output
vincent-bareiss Apr 10, 2022
42e5764
Changes to reflect new structure of pass repo
vincent-bareiss Jul 19, 2022
1167b2f
fix spelling mistake in gpg key import
Sep 15, 2022
1d23764
update for docker compose
windrad6 Mar 14, 2024
cc52e9b
added env to create script
windrad6 Apr 16, 2024
b577c35
add ansible vault secret generation, fix hostname setting, update readme
windrad6 Apr 17, 2024
b1614b3
remove git token. Now part of the git url
windrad6 Apr 17, 2024
223e09f
Merge pull request #6 from windrad6/development
windrad6 Apr 23, 2024
69d3da0
Allow generation of images based on ubuntu 24.04
Hobbbbes Apr 30, 2024
39911c7
Merge pull request #7 from Hobbbbes/ubuntu24.04
windrad6 May 14, 2024
0535c6b
Added support for a VAULT_KEY env variable
May 27, 2024
b684ce2
Added info about VAULT_KEY variable to README.md and fixed the flavor…
May 27, 2024
37eeadd
Merge pull request #8 from Hobbbbes/vaultkey
windrad6 Jul 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ imagebuilder
|TAG | A tag that is added to the name|
|RAW_OUTPOUT | Set to yes to get the .img file as output|
|TOKEN | A token used by Ansible|
|VAULT_KEY | Key to use in the vaultkey.secret file|

### List of flavors

ubuntu24.04

ubuntu22.04

ubuntu20.04
Expand All @@ -69,8 +72,8 @@ Run mount command. Make sure to update the offset (526336) for the correct value
`mount ubuntu-22.04.4-preinstalled-server-arm64+raspi.img -o loop,offset=$(( 512 * 526336)) /mnt/`

## How to add my custom secrets file for ansible vaults?
Copy the file in `out/output`. and make sure that the name is NODENAME-vaultkey.secret

To use a custom secret the VAULT_KEY variable can be set. If a vaultkey file of the name NODENAME-vaultkey.secret already exists the variable will be ignored.

[![GitHub](https://img.shields.io/github/license/ERIGrid2/riasc-provisioning)](https://github.com/ERIGrid2/riasc-provisioning/blob/master/LICENSE)

Expand Down
9 changes: 7 additions & 2 deletions rpi/create_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ echo "Using token: ${TOKEN}"
echo "Using flavor: ${FLAVOR}"
echo "Using repo: ${GIT_URL}"
echo "Using branch: ${GIT_BRANCH}"
if [! -z "$VAULT_KEY" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [! -z "$VAULT_KEY" ]; then
if [ ! -z "$VAULT_KEY" ]; then

echo "Using ansible secret ${VAULT_KEY}"
fi

# Check that required commands exist
echo "Check if required commands are installed..."
Expand Down Expand Up @@ -166,8 +169,10 @@ sed -i \

#Generate ansible secret
if [ ! -f ${OUTPUT_FOLDER}/"${NODENAME}"-vaultkey.secret ]; then
echo "Generate ansible secret"
VAULT_KEY=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 20; echo)
if [ -z "$VAULT_KEY" ]; then
echo "Generate ansible secret"
VAULT_KEY=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 20; echo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VAULT_KEY=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 20; echo)
VAULT_KEY=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c 20; echo)

fi
cat <<EOF > ${OUTPUT_FOLDER}/"${NODENAME}"-vaultkey.secret
#!/bin/bash
echo "${VAULT_KEY}"
Expand Down