Ansible #7
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: Install Ansible, curl, docker, kubectl, AZ CLI | |
run: | | |
sudo apt update && sudo apt upgrade | |
sudo apt install software-properties-common | |
sudo add-apt-repository --update ppa:ansible/ansible | |
sudo apt install ansible | |
sudo apt install docker.io | |
sudo systemctl start docker | |
sudo systemctl enable docker | |
sudo apt install curl | |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
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 | |