This commit is contained in:
mwiegand 2021-06-19 12:11:40 +02:00
parent ab14522e97
commit 638932b1ee
4 changed files with 37 additions and 0 deletions

2
bundles/gcloud/README.md Normal file
View file

@ -0,0 +1,2 @@
# gcloud projects add-iam-policy-binding sublimity-182017 --member 'serviceAccount:backup@sublimity-182017.iam.gserviceaccount.com' --role 'roles/storage.objectViewer'
# gcloud projects add-iam-policy-binding sublimity-182017 --member 'serviceAccount:backup@sublimity-182017.iam.gserviceaccount.com' --role 'roles/storage.objectCreator'

View file

@ -0,0 +1,30 @@
from os.path import join
service_account = node.metadata.get('gcloud/service_account')
project = node.metadata.get('gcloud/project')
files[f'/root/.config/gcloud/service_account.json'] = {
'content': repo.vault.decrypt_file(
join(repo.path, 'data', 'gcloud', 'service_accounts', f'{service_account}@{project}.json.enc')
),
'mode': '500',
'needs': [
'pkg_apt:google-cloud-sdk',
],
}
actions['gcloud_activate_service_account'] = {
'command': 'gcloud auth activate-service-account --key-file /root/.config/gcloud/service_account.json',
'unless': f"gcloud auth list | grep -q '^\*[[:space:]]*{service_account}@{project}.iam.gserviceaccount.com'",
'needs': [
f'file:/root/.config/gcloud/service_account.json'
],
}
actions['gcloud_select_project'] = {
'command': f"gcloud config set project '{project}'",
'unless': f"gcloud config get-value project | grep -q '^{project}$'",
'needs': [
f'action:gcloud_activate_service_account'
],
}

View file

@ -0,0 +1 @@
encrypt$gAAAAABgzbX64G_2XFuGX4gcdRqms9eiov9FS_p2gwhkJGLTRd8uR8QfxzcUg_RJDuSOhE3lE5mQPjfgjYJ0Bluv87MT8y-Cn16smz0ONWaMusjNR23CJQc9MHfyyxAV6pUiwrqExacY7dS-VDvV_QzpZTbM2WqKHIpxqrzyDSQfFW9LnSZYSEERAmJe4k87vjlOWsbXo2zfo1GJe2eTJO2wUkdzBR0M1EUvG769e0a1NoT_yeRJdid3YAiQi7Zzvmaf_p5SuXQ8IJrDJWL0_citS6XW-mh2blJVjGB1BHGypeAnSRhXbdNouqCYKj6p3bxmpyX2Ao076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WCaTAaoSZY3z_D5tR3m8KZGy5GIQb2vW9ldtWw8j80dROIVMuqpvVHWbty-jybq1h-SHoyDe0qut8l592XtKQrpjtCK_zLLpBsye6Y0XCvYOOAP260xvwDeWNisoWEmUYpE2O3ZDGLbNAi2l5c2rgQL17Iv_lkPAHv8d5tDTA0nhAkCuoegBRGaoQcYzdfsihFHjTCPYJIShFvqWRKmPPPaOyz-6pGssn1RpzyQFMqq0RxWqsckZG_pKFr-nYPjA-zOTlXjV6D98NjeQLm-tSthey-thHqovrd1oWYbuphR2Hf9h9hLFQFaeFRDtpO--Vqn1rjlOeZvkovNHSvs024PaY_fdu3wjnY_Pik5RNPauFB8eE72avpLhVjkADavqmhXBVN-D-k0fkB56iPmHosifQUUQko4XSDuMYd-Rw7ZRfRdW1PNmti510OlQWKk0hLhy1zmPThjKH7Jaj4mkgvKl61fcZ0BqgzV8UKG3zprZCsGRuXfBEmGEw4R7Jjft-s8lsXher-VceQuf-dbcnzIzZ0EpUf1BIvevy1wvICW1aCD7H-_FhhBHtepNgj-f9JBzimO2mxAcgfNipMR2PaU96fwziOhIoD76QdHDvZ4soc5TQI010HYUnZdxL5KZY5ZjIJs4tTtVUxiKzJ0GR0QqrxBwNi8YImg==

View file

@ -1,5 +1,9 @@
{
'metadata': {
'dns': {},
'gcloud': {
'service_account': 'backup',
'project': 'sublimity-182017',
},
}
}