Loading README.md +3 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,7 @@ Here are variables supported to configure the integration environment: | :lock: `ANSIBLE_REVIEW_PRIVATE_KEY` | The SSH private key to be use in `review` env | `$ANSIBLE_PRIVATE_KEY` | | `ANSIBLE_REVIEW_PUBLIC_KEY` | The SSH public key associated to the private key to be use in `review` env | `$ANSIBLE_PUBLIC_KEY` | | :lock: `ANSIBLE_REVIEW_VAULT_PASSWORD` | The Ansible vault password for `review` env | `$ANSIBLE_VAULT_PASSWORD` | | `ANSIBLE_REVIEW_AUTOSTOP_DURATION`| The amount of time before GitLab will automatically stop `review` environments | `4 hours` | ### Integration environment configuration Loading @@ -296,6 +297,7 @@ Here are variables supported to configure the integration environment: | :lock: `ANSIBLE_INTEG_PRIVATE_KEY` | The SSH private key to be use in `integration` env | `$ANSIBLE_PRIVATE_KEY` | | `ANSIBLE_INTEG_PUBLIC_KEY` | The SSH public key associated to the private key to be use in `integration` env | `$ANSIBLE_PUBLIC_KEY` | | :lock: `ANSIBLE_INTEG_VAULT_PASSWORD` | The Ansible vault password for `integration` env | `$ANSIBLE_VAULT_PASSWORD` | | `ANSIBLE_INTEG_AUTOSTOP_DURATION`| The amount of time before GitLab will automatically stop the `integration` env | `never` | ### Staging environment configuration Loading @@ -318,6 +320,7 @@ Here are variables supported to configure the staging environment: | :lock: `ANSIBLE_STAGING_PRIVATE_KEY` | The SSH private key to be use in `staging` env | `$ANSIBLE_PRIVATE_KEY` | | `ANSIBLE_STAGING_PUBLIC_KEY` | The SSH public key associated to the private key to be use in `staging` env | `$ANSIBLE_PUBLIC_KEY` | | :lock: `ANSIBLE_STAGING_VAULT_PASSWORD` | The Ansible vault password for `staging` env | `$ANSIBLE_VAULT_PASSWORD` | | `ANSIBLE_STAGING_AUTOSTOP_DURATION`| The amount of time before GitLab will automatically stop the `staging` env | `never` | ### Production environment configuration Loading kicker.json +15 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,11 @@ "advanced": true, "default": "$ANSIBLE_DEFAULT_EXTRA_ARGS" }, { "name": "ANSIBLE_REVIEW_AUTOSTOP_DURATION", "description": "The amount of time before GitLab will automatically stop `review` environments", "default": "4 hours" }, { "name": "ANSIBLE_REVIEW_PLAYBOOK_FILE", "description": " The playbook filename for `review` env", Loading Loading @@ -180,6 +185,11 @@ "description": "The application name for integration env (only define if different from global)", "advanced": true }, { "name": "ANSIBLE_INTEG_AUTOSTOP_DURATION", "description": "The amount of time before GitLab will automatically stop the `integration` env", "default": "never" }, { "name": "ANSIBLE_INTEG_ENVIRONMENT_URL", "type": "url", Loading Loading @@ -250,6 +260,11 @@ "description": "The application name for staging env (only define if different from global)", "advanced": true }, { "name": "ANSIBLE_STAGING_AUTOSTOP_DURATION", "description": "The amount of time before GitLab will automatically stop the `staging` env", "default": "never" }, { "name": "ANSIBLE_STAGING_ENVIRONMENT_URL", "type": "url", Loading templates/gitlab-ci-ansible.yml +16 −11 Original line number Diff line number Diff line Loading @@ -69,6 +69,10 @@ variables: ANSIBLE_HOST_KEY_CHECKING: "false" ANSIBLE_DEFAULT_ROLES_PATH: "$CI_PROJECT_DIR/roles" ANSIBLE_REVIEW_AUTOSTOP_DURATION: "4 hours" ANSIBLE_INTEG_AUTOSTOP_DURATION: "never" ANSIBLE_STAGING_AUTOSTOP_DURATION: "never" # default: one-click deploy ANSIBLE_PROD_DEPLOY_STRATEGY: manual Loading Loading @@ -330,9 +334,13 @@ stages: tags=$2 extra_opts=$3 playbook_file=$4 private_key=$5 public_key=$6 vault_password=$7 export environment_type=$ENV_TYPE export environment_name=${ENV_APP_NAME:-${ANSIBLE_BASE_APP_NAME}${ENV_APP_SUFFIX}} export environment_url=${ENV_URL:-${ANSIBLE_ENVIRONMENT_URL:-$CI_ENVIRONMENT_URL}} private_key=${ENV_PRIVATE_KEY:-$ANSIBLE_PRIVATE_KEY} public_key=${ENV_PUBLIC_KEY:-$ANSIBLE_PUBLIC_KEY} vault_password=${ENV_VAULT_PASSWORD:-$ANSIBLE_VAULT_PASSWORD} # variables expansion in $environment_url environment_url=$(echo "$environment_url" | awkenvsubst) Loading Loading @@ -474,8 +482,8 @@ stages: .ansible-commands: default: deploy: run_ansible "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" "${ENV_TAGS:-${ANSIBLE_DEFAULT_TAGS}}" "${ENV_EXTRA_ARGS:-${ANSIBLE_DEFAULT_EXTRA_ARGS}}" "${ENV_PLAYBOOK_FILE}" "${ENV_PRIVATE_KEY:-${ANSIBLE_PRIVATE_KEY}}" "${ENV_PUBLIC_KEY:-${ANSIBLE_PUBLIC_KEY}}" "${ENV_VAULT_PASSWORD:-${ANSIBLE_VAULT_PASSWORD}}" cleanup: run_ansible "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" "$ENV_CLEANUP_TAGS" "${ENV_EXTRA_ARGS:-${ANSIBLE_DEFAULT_EXTRA_ARGS}}" "${ENV_CLEANUP_PLAYBOOK_FILE:-${ENV_PLAYBOOK_FILE}}" "${ENV_PRIVATE_KEY:-${ANSIBLE_PRIVATE_KEY}}" "${ENV_PUBLIC_KEY:-${ANSIBLE_PUBLIC_KEY}}" "${ENV_VAULT_PASSWORD:-${ANSIBLE_VAULT_PASSWORD}}" deploy: run_ansible "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" "${ENV_TAGS:-${ANSIBLE_DEFAULT_TAGS}}" "${ENV_EXTRA_ARGS:-${ANSIBLE_DEFAULT_EXTRA_ARGS}}" "${ENV_PLAYBOOK_FILE}" cleanup: run_ansible "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" "$ENV_CLEANUP_TAGS" "${ENV_EXTRA_ARGS:-${ANSIBLE_DEFAULT_EXTRA_ARGS}}" "${ENV_CLEANUP_PLAYBOOK_FILE:-${ENV_PLAYBOOK_FILE}}" deploy: - !reference [ .ansible-commands, default, deploy ] cleanup: Loading Loading @@ -574,9 +582,6 @@ ansible-lint: - cd $ANSIBLE_PROJECT_DIR - assert_defined "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" 'Missing required Ansible inventory' - assert_defined "${ENV_PLAYBOOK_FILE}" 'Missing required Ansible playbook' - export environment_type="$ENV_TYPE" - export environment_name="${ENV_APP_NAME:-${ANSIBLE_BASE_APP_NAME}${ENV_APP_SUFFIX}}" - export environment_url="${ENV_URL:-${ANSIBLE_ENVIRONMENT_URL:-$CI_ENVIRONMENT_URL}}" - chmod go-rwx . script: - !reference [ .ansible-commands, deploy ] Loading Loading @@ -618,8 +623,6 @@ ansible-lint: - assert_defined "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" 'Missing required Ansible inventory' - assert_defined "${ENV_CLEANUP_PLAYBOOK_FILE:-${ENV_PLAYBOOK_FILE}}" 'Missing required Ansible playbook' - assert_defined "$ENV_CLEANUP_TAGS" 'Missing required Ansible cleanup tags' - export environment_type="$ENV_TYPE" - export environment_name="${ENV_APP_NAME:-${ANSIBLE_BASE_APP_NAME}${ENV_APP_SUFFIX}}" - chmod go-rwx . script: - !reference [ .ansible-commands, cleanup ] Loading Loading @@ -648,6 +651,7 @@ ansible-review: environment: name: review/$CI_COMMIT_REF_NAME on_stop: ansible-cleanup-review auto_stop_in: "$ANSIBLE_REVIEW_AUTOSTOP_DURATION" resource_group: review/$CI_COMMIT_REF_NAME rules: # exclude tags Loading Loading @@ -705,6 +709,7 @@ ansible-integration: environment: name: integration on_stop: ansible-cleanup-integration auto_stop_in: "$ANSIBLE_INTEG_AUTOSTOP_DURATION" resource_group: integration rules: # only on integration branch(es), with $ANSIBLE_INTEG_PLAYBOOK_FILE set Loading Loading @@ -757,6 +762,7 @@ ansible-staging: environment: name: staging on_stop: ansible-cleanup-staging auto_stop_in: "$ANSIBLE_STAGING_AUTOSTOP_DURATION" resource_group: staging rules: # only on production branch(es), with $ANSIBLE_STAGING_PLAYBOOK_FILE set Loading Loading @@ -793,7 +799,6 @@ ansible-cleanup-staging: ############################### # Prod # ############################### ansible-production: extends: .ansible-deploy stage: production Loading Loading
README.md +3 −0 Original line number Diff line number Diff line Loading @@ -274,6 +274,7 @@ Here are variables supported to configure the integration environment: | :lock: `ANSIBLE_REVIEW_PRIVATE_KEY` | The SSH private key to be use in `review` env | `$ANSIBLE_PRIVATE_KEY` | | `ANSIBLE_REVIEW_PUBLIC_KEY` | The SSH public key associated to the private key to be use in `review` env | `$ANSIBLE_PUBLIC_KEY` | | :lock: `ANSIBLE_REVIEW_VAULT_PASSWORD` | The Ansible vault password for `review` env | `$ANSIBLE_VAULT_PASSWORD` | | `ANSIBLE_REVIEW_AUTOSTOP_DURATION`| The amount of time before GitLab will automatically stop `review` environments | `4 hours` | ### Integration environment configuration Loading @@ -296,6 +297,7 @@ Here are variables supported to configure the integration environment: | :lock: `ANSIBLE_INTEG_PRIVATE_KEY` | The SSH private key to be use in `integration` env | `$ANSIBLE_PRIVATE_KEY` | | `ANSIBLE_INTEG_PUBLIC_KEY` | The SSH public key associated to the private key to be use in `integration` env | `$ANSIBLE_PUBLIC_KEY` | | :lock: `ANSIBLE_INTEG_VAULT_PASSWORD` | The Ansible vault password for `integration` env | `$ANSIBLE_VAULT_PASSWORD` | | `ANSIBLE_INTEG_AUTOSTOP_DURATION`| The amount of time before GitLab will automatically stop the `integration` env | `never` | ### Staging environment configuration Loading @@ -318,6 +320,7 @@ Here are variables supported to configure the staging environment: | :lock: `ANSIBLE_STAGING_PRIVATE_KEY` | The SSH private key to be use in `staging` env | `$ANSIBLE_PRIVATE_KEY` | | `ANSIBLE_STAGING_PUBLIC_KEY` | The SSH public key associated to the private key to be use in `staging` env | `$ANSIBLE_PUBLIC_KEY` | | :lock: `ANSIBLE_STAGING_VAULT_PASSWORD` | The Ansible vault password for `staging` env | `$ANSIBLE_VAULT_PASSWORD` | | `ANSIBLE_STAGING_AUTOSTOP_DURATION`| The amount of time before GitLab will automatically stop the `staging` env | `never` | ### Production environment configuration Loading
kicker.json +15 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,11 @@ "advanced": true, "default": "$ANSIBLE_DEFAULT_EXTRA_ARGS" }, { "name": "ANSIBLE_REVIEW_AUTOSTOP_DURATION", "description": "The amount of time before GitLab will automatically stop `review` environments", "default": "4 hours" }, { "name": "ANSIBLE_REVIEW_PLAYBOOK_FILE", "description": " The playbook filename for `review` env", Loading Loading @@ -180,6 +185,11 @@ "description": "The application name for integration env (only define if different from global)", "advanced": true }, { "name": "ANSIBLE_INTEG_AUTOSTOP_DURATION", "description": "The amount of time before GitLab will automatically stop the `integration` env", "default": "never" }, { "name": "ANSIBLE_INTEG_ENVIRONMENT_URL", "type": "url", Loading Loading @@ -250,6 +260,11 @@ "description": "The application name for staging env (only define if different from global)", "advanced": true }, { "name": "ANSIBLE_STAGING_AUTOSTOP_DURATION", "description": "The amount of time before GitLab will automatically stop the `staging` env", "default": "never" }, { "name": "ANSIBLE_STAGING_ENVIRONMENT_URL", "type": "url", Loading
templates/gitlab-ci-ansible.yml +16 −11 Original line number Diff line number Diff line Loading @@ -69,6 +69,10 @@ variables: ANSIBLE_HOST_KEY_CHECKING: "false" ANSIBLE_DEFAULT_ROLES_PATH: "$CI_PROJECT_DIR/roles" ANSIBLE_REVIEW_AUTOSTOP_DURATION: "4 hours" ANSIBLE_INTEG_AUTOSTOP_DURATION: "never" ANSIBLE_STAGING_AUTOSTOP_DURATION: "never" # default: one-click deploy ANSIBLE_PROD_DEPLOY_STRATEGY: manual Loading Loading @@ -330,9 +334,13 @@ stages: tags=$2 extra_opts=$3 playbook_file=$4 private_key=$5 public_key=$6 vault_password=$7 export environment_type=$ENV_TYPE export environment_name=${ENV_APP_NAME:-${ANSIBLE_BASE_APP_NAME}${ENV_APP_SUFFIX}} export environment_url=${ENV_URL:-${ANSIBLE_ENVIRONMENT_URL:-$CI_ENVIRONMENT_URL}} private_key=${ENV_PRIVATE_KEY:-$ANSIBLE_PRIVATE_KEY} public_key=${ENV_PUBLIC_KEY:-$ANSIBLE_PUBLIC_KEY} vault_password=${ENV_VAULT_PASSWORD:-$ANSIBLE_VAULT_PASSWORD} # variables expansion in $environment_url environment_url=$(echo "$environment_url" | awkenvsubst) Loading Loading @@ -474,8 +482,8 @@ stages: .ansible-commands: default: deploy: run_ansible "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" "${ENV_TAGS:-${ANSIBLE_DEFAULT_TAGS}}" "${ENV_EXTRA_ARGS:-${ANSIBLE_DEFAULT_EXTRA_ARGS}}" "${ENV_PLAYBOOK_FILE}" "${ENV_PRIVATE_KEY:-${ANSIBLE_PRIVATE_KEY}}" "${ENV_PUBLIC_KEY:-${ANSIBLE_PUBLIC_KEY}}" "${ENV_VAULT_PASSWORD:-${ANSIBLE_VAULT_PASSWORD}}" cleanup: run_ansible "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" "$ENV_CLEANUP_TAGS" "${ENV_EXTRA_ARGS:-${ANSIBLE_DEFAULT_EXTRA_ARGS}}" "${ENV_CLEANUP_PLAYBOOK_FILE:-${ENV_PLAYBOOK_FILE}}" "${ENV_PRIVATE_KEY:-${ANSIBLE_PRIVATE_KEY}}" "${ENV_PUBLIC_KEY:-${ANSIBLE_PUBLIC_KEY}}" "${ENV_VAULT_PASSWORD:-${ANSIBLE_VAULT_PASSWORD}}" deploy: run_ansible "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" "${ENV_TAGS:-${ANSIBLE_DEFAULT_TAGS}}" "${ENV_EXTRA_ARGS:-${ANSIBLE_DEFAULT_EXTRA_ARGS}}" "${ENV_PLAYBOOK_FILE}" cleanup: run_ansible "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" "$ENV_CLEANUP_TAGS" "${ENV_EXTRA_ARGS:-${ANSIBLE_DEFAULT_EXTRA_ARGS}}" "${ENV_CLEANUP_PLAYBOOK_FILE:-${ENV_PLAYBOOK_FILE}}" deploy: - !reference [ .ansible-commands, default, deploy ] cleanup: Loading Loading @@ -574,9 +582,6 @@ ansible-lint: - cd $ANSIBLE_PROJECT_DIR - assert_defined "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" 'Missing required Ansible inventory' - assert_defined "${ENV_PLAYBOOK_FILE}" 'Missing required Ansible playbook' - export environment_type="$ENV_TYPE" - export environment_name="${ENV_APP_NAME:-${ANSIBLE_BASE_APP_NAME}${ENV_APP_SUFFIX}}" - export environment_url="${ENV_URL:-${ANSIBLE_ENVIRONMENT_URL:-$CI_ENVIRONMENT_URL}}" - chmod go-rwx . script: - !reference [ .ansible-commands, deploy ] Loading Loading @@ -618,8 +623,6 @@ ansible-lint: - assert_defined "${ENV_INVENTORY:-${ANSIBLE_DEFAULT_INVENTORY}}" 'Missing required Ansible inventory' - assert_defined "${ENV_CLEANUP_PLAYBOOK_FILE:-${ENV_PLAYBOOK_FILE}}" 'Missing required Ansible playbook' - assert_defined "$ENV_CLEANUP_TAGS" 'Missing required Ansible cleanup tags' - export environment_type="$ENV_TYPE" - export environment_name="${ENV_APP_NAME:-${ANSIBLE_BASE_APP_NAME}${ENV_APP_SUFFIX}}" - chmod go-rwx . script: - !reference [ .ansible-commands, cleanup ] Loading Loading @@ -648,6 +651,7 @@ ansible-review: environment: name: review/$CI_COMMIT_REF_NAME on_stop: ansible-cleanup-review auto_stop_in: "$ANSIBLE_REVIEW_AUTOSTOP_DURATION" resource_group: review/$CI_COMMIT_REF_NAME rules: # exclude tags Loading Loading @@ -705,6 +709,7 @@ ansible-integration: environment: name: integration on_stop: ansible-cleanup-integration auto_stop_in: "$ANSIBLE_INTEG_AUTOSTOP_DURATION" resource_group: integration rules: # only on integration branch(es), with $ANSIBLE_INTEG_PLAYBOOK_FILE set Loading Loading @@ -757,6 +762,7 @@ ansible-staging: environment: name: staging on_stop: ansible-cleanup-staging auto_stop_in: "$ANSIBLE_STAGING_AUTOSTOP_DURATION" resource_group: staging rules: # only on production branch(es), with $ANSIBLE_STAGING_PLAYBOOK_FILE set Loading Loading @@ -793,7 +799,6 @@ ansible-cleanup-staging: ############################### # Prod # ############################### ansible-production: extends: .ansible-deploy stage: production Loading