Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Gitlab
- # На этом шаге деплоится AIO стенд
- deploy_aio:
- stage: deploy
- when: manual
- environment:
- name: ${CI_COMMIT_REF_SLUG}
- url: http://${CI_COMMIT_REF_SLUG}.dev.domain.com
- before_script:
- - git clone [email protected]:robot_robert/abagy-deploy.git
- - cd abagy-deploy
- script:
- - ansible-playbook --diff -i inventories/aio/hosts.aio-custom.ini playbooks/deploy-aio.yml
- --private-key=~/.ssh/rwc_deploy
- -u deploy
- -e "debug=false"
- -e "default_docker_image_tag=${CI_COMMIT_REF_SLUG}"
- -e "host_name=${AIO_HOST}"
- only:
- - merge_requests
- extends: .shell-builders
- ================================================
- # Ansible, но можешь через баш делать
- ---
- - name: "Step 1: Provision AIO"
- hosts: localhost
- gather_facts: false
- connection: local
- tasks:
- - name: Collect info
- terraform:
- project_path: "{{ tf_project_path }}"
- state: "{{ vm_state }}"
- force_init: true
- variables:
- host_name: "{{ host_name }}"
- variables_file: "{{ tf_variables_file }}"
- backend_config:
- key: "development/{{ host_name }}.tfstate"
- access_key: "{{ minio_terraform_access_key }}"
- secret_key: "{{ minio_terraform_secret_key }}"
- register: create_vm
- tags:
- - destroy
- - name: Print terraform output
- debug:
- var: create_vm
- tags:
- - destroy
- - name: Add host to app group
- add_host:
- hostname: "{{ create_vm.outputs.server_name.value }}"
- ansible_ssh_host: "{{ create_vm.outputs.server_ip.value }}"
- groups:
- - app
- delegate_to: localhost
- when: vm_state == "present"
- - name: "Step 3: Deploy application"
- hosts: app
- become: true
- roles:
- - { role: robocloud, when: vm_state == "present" }
- =========================
- # hosts.aio-custom.ini
- [app]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement