Ansible #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ansible | |
on: | |
workflow_dispatch: | |
inputs: | |
IP_publica: | |
type: string | |
description: IP pública de la VM de IBM Cloud | |
required: true | |
jobs: | |
Ansible: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: checks | |
run: whoami && ls -la | |
- name: Install Ansible, curl, docker, kubectl, AZ CLI | |
run: | | |
echo "1234" | sudo -S su | |
echo "1234" |sudo -S apt update && sudo apt upgrade | |
echo "1234" |sudo -S apt install software-properties-common | |
echo "1234" |sudo -S add-apt-repository --update ppa:ansible/ansible | |
echo "1234" |sudo -S apt install ansible | |
echo "1234" |sudo -S apt install docker.io | |
echo "1234" |sudo -S systemctl start docker | |
echo "1234" |sudo -S systemctl enable docker | |
echo "1234" |sudo -S apt install curl | |
echo "1234" |sudo -S curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
echo "1234" | sudo -S install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | |
- name: Generar inventario de ansible | |
run: | | |
cd ansible | |
touch inventory.ini | |
echo "[vm]" >> inventory.ini | |
echo "${{inputs.IP_publica}} ansible_user=alejandroBD ansible_password=${{secrets.ANSIBLE_PASSWORD}} ansible_become=true ansible_become_method=sudo " >> inventory.ini | |
# - name: Instalar PostgreSQL en la maquina de BBDD | |
# run: cd ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory.ini postgre.yml -u alejandroBD | |
# env: | |
# PG_USER: ${{ secrets.PG_USER }} | |
# PG_PASSWORD: ${{secrets.PG_PASSWORD}} | |
# - name: Hacer backup de la base de datos en la maquina de backups | |
# run: | | |
# cd ansible && ansible-playbook -i inventory.ini backup.yml -u alejandro | |