curl -o /etc/ssh/trusted-user-ca-keys.pem https://vault.coopdevs.org/v1/ssh-client-signer/public_key
# as root
echo "TrustedUserCAKeys /etc/ssh/trusted-user-ca-keys.pem" >> /etc/ssh/sshd_config.d/vault.conf
service sshd restart
sudo useradd -m coopbot
sudo usermod -a -G sysadmin coopbot
[TODO: explore which permissions are required]
Vault Gitlab Initializer
Vault Gitlab Initializer is a CLI tool is designed to initialize instances for our CI/CD stack, integrating HashiCorp Vault and GitLab. It creates users, roles and policies in Vault, create and stores secrets, and updates environment variables in a GitLab repository based on the provided configurations.
It will:
.vault-pass.sh
file to repositoryVault Gitlab Initializer
in the inventory repository:PROD_DOMAIN=vault-test.devs.coop
VAULT_USER=citest
VAULT_SERVER_URL=https://vault.coopdevs.org
The .vault-pass.sh
file should be in the root of the repository.
Edit the gitlab-ci.yml
file:
include:
- project: 'coopdevs/ci-cd/odoo-deploy'
file: 'deploy.yml'
# optional
file: 'badge.yml'
auto-deploy
topic to repository in Settings > GeneralDon’t miss this! Change CI/CD visibility are set to ‘Project Members’ in Settings > General > Visibility.
## Check list for autodeployments
- [ ] Enable SSH signed keys as method in remote server.
- [ ] Create a deploy user in remote server.
- [ ] Run the `Vault Gitlab Initializer`
- [X] Create user and policy and store secret in Vault
- [X] Add CI/CD environment variables to Gitlab repository.
- [X] Created an executable `vault-pass.sh` file to retrieve the Ansible Secret
- [ ] Update `.gitlab-ci.yml` to include deploy template
- [ ] Change CI/CD visibility and set topic on repositor settings.