Skip to content

Commit

Permalink
Update ansible_wordpress_installation.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
DonComProject authored May 20, 2024
1 parent b9b7125 commit 06c0ceb
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/scripts/ansible_wordpress_installation.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Actualizar la lista de paquetes
sudo apt-get update
sudo apt-get update

# Descargar el playbook de Ansible
wget https://raw.githubusercontent.com/DonComProject/arenita/main/src/ansible/hammad_wordpress.yml
Expand All @@ -13,13 +13,29 @@ sudo apt-get install -y ansible sshpass python3-pip
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" -q <<< y

# Copiar la clave pública al host local
sudo ssh-copy-id -i ~/.ssh/id_rsa.pub usuario@$(hostname -I | cut -d ' ' -f1)
ssh-copy-id -i ~/.ssh/id_rsa.pub usuario@$(hostname -I | cut -d ' ' -f1)

# Actualizar Ansible con pip
pip install --upgrade ansible

# Instalar la colección community.mysql
sudo ansible-galaxy collection install community.mysql

# Crear la carpeta /etc/ansible si no existe
if [ ! -d /etc/ansible ]; then
sudo mkdir -p /etc/ansible
fi

# Crear archivo hosts si no existe
if [ ! -f /etc/ansible/hosts ]; then
sudo touch /etc/ansible/hosts
fi

# Añadir al final del archivo hosts el siguiente contenido:
# [clientes]
# (y añadir la ip de la maquina que estoy usando el script ahora mismo)
echo "[clientes]" | sudo tee -a /etc/ansible/hosts
echo "$(hostname -I | cut -d ' ' -f1)" | sudo tee -a /etc/ansible/hosts

# Ejecutar el playbook de Ansible
sudo ansible-playbook hammad_wordpress.yml -k -b -K

0 comments on commit 06c0ceb

Please sign in to comment.