Convert ansible inventory to yaml

This commit is contained in:
Mangiang 2021-11-02 10:32:21 -04:00
parent 268411136b
commit a1780ace46
No known key found for this signature in database
GPG Key ID: DAE9B92A692CD55C
2 changed files with 16 additions and 9 deletions

View File

@ -1,2 +1,8 @@
[host] all:
{{ DEPLOYMENT_USER }}@{{ DEPLOY_HOSTNAME }} ansible_connection=ssh ansible_user={{ DEPLOYMENT_USER }} ansible_ssh_pass={{ DEPLOYMENT_SSH_KEY_PASSPHRASE }} children:
host:
ansible_host: {{ DEPLOY_HOSTNAME }}
ansible_user: {{ DEPLOYMENT_USER }}
ansible_connection: ssh
ansible_ssh_private_key_file: private.key
ansible_ssh_pass: {{ DEPLOYMENT_SSH_KEY_PASSPHRASE }}

View File

@ -25,12 +25,15 @@ steps:
from_secret: deploy_username from_secret: deploy_username
DEPLOYMENT_SSH_KEY_PASSPHRASE: DEPLOYMENT_SSH_KEY_PASSPHRASE:
from_secret: deploy_ssh_key_passphrase from_secret: deploy_ssh_key_passphrase
PRIVATE_KEY:
from_secret: deploy_ssh_key
commands: commands:
- sed -i 's/{{ SPT_ITEMS_HOSTNAME }}/'"$SPT_ITEMS_HOSTNAME"'/g' ./items/frontend/.env.example - sed -i 's/{{ SPT_ITEMS_HOSTNAME }}/'"$SPT_ITEMS_HOSTNAME"'/g' ./items/frontend/.env.example
- mv ./items/frontend/.env.example ./items/frontend/.env - mv ./items/frontend/.env.example ./items/frontend/.env
- sed -i 's/{{ DEPLOY_HOSTNAME }}/'"$DEPLOY_HOSTNAME"'/g' ./.ansible-items/inventory - echo "{{ PRIVATE_KEY }}" > private.key
- sed -i 's/{{ DEPLOYMENT_SSH_KEY_PASSPHRASE }}/'"$DEPLOYMENT_SSH_KEY_PASSPHRASE"'/g' ./.ansible-items/inventory - sed -i 's/{{ DEPLOY_HOSTNAME }}/'"$DEPLOY_HOSTNAME"'/g' ./.ansible-items/inventory
- sed -i 's/{{ DEPLOYMENT_USER }}/'"$DEPLOYMENT_USER"'/g' ./.ansible-items/inventory - sed -i 's/{{ DEPLOYMENT_SSH_KEY_PASSPHRASE }}/'"$DEPLOYMENT_SSH_KEY_PASSPHRASE"'/g' ./.ansible-items/inventory
- sed -i 's/{{ DEPLOYMENT_USER }}/'"$DEPLOYMENT_USER"'/g' ./.ansible-items/inventory
- name: build frontend - name: build frontend
image: node:lts-alpine3.14 image: node:lts-alpine3.14
@ -61,8 +64,6 @@ steps:
playbook: ./.ansible-items/playbook.yml playbook: ./.ansible-items/playbook.yml
inventory: ./.ansible-items/inventory inventory: ./.ansible-items/inventory
galaxy: ./.ansible-items/requirements.yml galaxy: ./.ansible-items/requirements.yml
private_key:
from_secret: deploy_ssh_key
environment: environment:
DEPLOY_HOSTNAME: DEPLOY_HOSTNAME:
from_secret: deploy_hostname from_secret: deploy_hostname