Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bbde468f2a | |||
| 44f1bf7ea7 | |||
| ab3267d33a | |||
| f4f79340f3 | |||
| 5f110722ea | |||
| b23442f8ec | |||
| b0f6a7de36 |
13
Vagrantfile
vendored
13
Vagrantfile
vendored
@@ -5,11 +5,15 @@ Vagrant.configure(2) do |config|
|
|||||||
ansible.vm.network "private_network", ip: "192.168.11.10" # IP privada
|
ansible.vm.network "private_network", ip: "192.168.11.10" # IP privada
|
||||||
ansible.vm.hostname = "ansible" # Nombre de host
|
ansible.vm.hostname = "ansible" # Nombre de host
|
||||||
ansible.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync" # Carpeta sincronizada
|
ansible.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync" # Carpeta sincronizada
|
||||||
|
ansible.vm.network "forwarded_port", guest: 32000, host: 32000
|
||||||
|
# No es necesario provisionar Ansible aquí, ya que si AWX está instalado, ya incluye Ansible
|
||||||
|
# Está incluido un script de aprovisionamiento básicamente para tener solo un Vagrantfile
|
||||||
|
# para todo el entorno Ansible y que instale dependencias adicionales si se requieren.
|
||||||
|
#ansible.vm.provision :shell, :path => "ansible.sh" # Script de aprovisionamiento
|
||||||
ansible.vm.provider "virtualbox" do |vb|
|
ansible.vm.provider "virtualbox" do |vb|
|
||||||
vb.memory = 512 # Memoria RAM asignada
|
vb.memory = 4096 # Memoria RAM asignada para tener AWX funcionando
|
||||||
vb.cpus = 1 # Número de CPUs asignadas
|
vb.cpus = 2 # Número de CPUs asignadas
|
||||||
end
|
end
|
||||||
ansible.vm.provision :shell, :path => "ansible.sh" # Script de aprovisionamiento
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Máquina para la base de datos
|
# Máquina para la base de datos
|
||||||
@@ -18,7 +22,6 @@ Vagrant.configure(2) do |config|
|
|||||||
database.vm.network "private_network", ip: "192.168.11.20"
|
database.vm.network "private_network", ip: "192.168.11.20"
|
||||||
database.vm.hostname = "database"
|
database.vm.hostname = "database"
|
||||||
database.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
|
database.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
|
||||||
database.vm.provision :shell, :path => "ansible.sh"
|
|
||||||
database.vm.network "forwarded_port", guest: 80, host: 8081 # Redirección del puerto 80
|
database.vm.network "forwarded_port", guest: 80, host: 8081 # Redirección del puerto 80
|
||||||
database.vm.network "forwarded_port", guest: 3306, host: 3306 # Redirección del puerto MySQL
|
database.vm.network "forwarded_port", guest: 3306, host: 3306 # Redirección del puerto MySQL
|
||||||
database.vm.provider "virtualbox" do |vb|
|
database.vm.provider "virtualbox" do |vb|
|
||||||
@@ -33,7 +36,6 @@ Vagrant.configure(2) do |config|
|
|||||||
loadbalancer.vm.network "private_network", ip: "192.168.11.30"
|
loadbalancer.vm.network "private_network", ip: "192.168.11.30"
|
||||||
loadbalancer.vm.hostname = "loadbalancer"
|
loadbalancer.vm.hostname = "loadbalancer"
|
||||||
loadbalancer.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
|
loadbalancer.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
|
||||||
loadbalancer.vm.provision :shell, :path => "ansible.sh"
|
|
||||||
loadbalancer.vm.network "forwarded_port", guest: 80, host: 8080 # Redirección del puerto 80
|
loadbalancer.vm.network "forwarded_port", guest: 80, host: 8080 # Redirección del puerto 80
|
||||||
loadbalancer.vm.network "forwarded_port", guest: 3306, host: 33061 # Redirección del puerto MySQL alternativo
|
loadbalancer.vm.network "forwarded_port", guest: 3306, host: 33061 # Redirección del puerto MySQL alternativo
|
||||||
loadbalancer.vm.provider "virtualbox" do |vb|
|
loadbalancer.vm.provider "virtualbox" do |vb|
|
||||||
@@ -48,7 +50,6 @@ Vagrant.configure(2) do |config|
|
|||||||
webserver.vm.network "private_network", ip: "192.168.11.40"
|
webserver.vm.network "private_network", ip: "192.168.11.40"
|
||||||
webserver.vm.hostname = "webserver"
|
webserver.vm.hostname = "webserver"
|
||||||
webserver.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
|
webserver.vm.synced_folder ".", "/home/vagrant/sync", type: "rsync"
|
||||||
webserver.vm.provision :shell, :path => "ansible.sh"
|
|
||||||
webserver.vm.network "forwarded_port", guest: 80, host: 80 # Redirección del puerto 80
|
webserver.vm.network "forwarded_port", guest: 80, host: 80 # Redirección del puerto 80
|
||||||
webserver.vm.network "forwarded_port", guest: 3306, host: 33062 # Redirección del puerto MySQL alternativo
|
webserver.vm.network "forwarded_port", guest: 3306, host: 33062 # Redirección del puerto MySQL alternativo
|
||||||
webserver.vm.provider "virtualbox" do |vb|
|
webserver.vm.provider "virtualbox" do |vb|
|
||||||
|
|||||||
97
ansible_awx_install.txt
Normal file
97
ansible_awx_install.txt
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
== 1. Update Your System ==
|
||||||
|
sudo apt update
|
||||||
|
sudo apt upgrade -y
|
||||||
|
|
||||||
|
== 2. Install k3s ==
|
||||||
|
curl -sfL https://get.k3s.io | sh -
|
||||||
|
|
||||||
|
== 3. Give Non-root User Access to K3s Config ==
|
||||||
|
sudo chown $USER:$USER /etc/rancher/k3s/k3s.yaml
|
||||||
|
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
||||||
|
|
||||||
|
== 4. Verify Kubernetes Cluster ==
|
||||||
|
kubectl version
|
||||||
|
kubectl get nodes
|
||||||
|
kubectl get pods -A
|
||||||
|
|
||||||
|
== 5. Install Kustomize ==
|
||||||
|
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||||
|
sudo mv kustomize /usr/local/bin
|
||||||
|
|
||||||
|
== 6. Create Kustomization Directory ==
|
||||||
|
mkdir awx-deploy && cd awx-deploy
|
||||||
|
|
||||||
|
== 7. Create kustomization.yaml ==
|
||||||
|
#create file
|
||||||
|
nano kustomization.yaml
|
||||||
|
|
||||||
|
#Add below to the file
|
||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- github.com/ansible/awx-operator/config/default?ref=2.19.1
|
||||||
|
|
||||||
|
images:
|
||||||
|
- name: quay.io/ansible/awx-operator
|
||||||
|
newTag: 2.19.1
|
||||||
|
|
||||||
|
namespace: awx
|
||||||
|
|
||||||
|
|
||||||
|
== 8. Apply Kustomize Configuration ==
|
||||||
|
kubectl apply -k .
|
||||||
|
|
||||||
|
OR
|
||||||
|
|
||||||
|
kustomize build . | kubectl apply -f -
|
||||||
|
|
||||||
|
== 9. Verify Operator is Running ==
|
||||||
|
kubectl get pods -n awx
|
||||||
|
|
||||||
|
== 10. Create AWX Instance. Create a file named awx-demo.yaml ==
|
||||||
|
#create file
|
||||||
|
nano awx-demo.yaml
|
||||||
|
|
||||||
|
#Add below to the file
|
||||||
|
---
|
||||||
|
apiVersion: awx.ansible.com/v1beta1
|
||||||
|
kind: AWX
|
||||||
|
metadata:
|
||||||
|
name: awx-demo
|
||||||
|
spec:
|
||||||
|
service_type: nodeport
|
||||||
|
nodeport_port: 32000
|
||||||
|
|
||||||
|
== 11. Add Instance to Kustomization ==
|
||||||
|
# Update your kustomization.yaml to include awx-demo.yaml
|
||||||
|
#edit file
|
||||||
|
nano kustomization.yaml
|
||||||
|
|
||||||
|
#add - awx-demo.yaml under resources
|
||||||
|
resources:
|
||||||
|
- github.com/ansible/awx-operator/config/default?ref=2.19.1
|
||||||
|
- awx-demo.yaml
|
||||||
|
|
||||||
|
images:
|
||||||
|
- name: quay.io/ansible/awx-operator
|
||||||
|
newTag: 2.19.1
|
||||||
|
|
||||||
|
namespace: awx
|
||||||
|
|
||||||
|
== 12. Reapply Kustomize Configuration ==
|
||||||
|
kubectl apply -k .
|
||||||
|
|
||||||
|
== 13. Check POD Status
|
||||||
|
kubectl get pods -n awx
|
||||||
|
|
||||||
|
== 14. View Logs ==
|
||||||
|
kubectl logs -f deployment/awx-operator-controller-manager -c awx-manager -n awx
|
||||||
|
|
||||||
|
== 15. Retrieve Admin Password ==
|
||||||
|
kubectl get secret awx-demo-admin-password -n awx -o jsonpath="{.data.password}" | base64 --decode ; echo
|
||||||
|
|
||||||
|
== 16. Access the AWX Dashboard ==
|
||||||
|
http://<your-server-ip>:32000
|
||||||
|
|
||||||
|
#Username: admin
|
||||||
|
#Password: (from previous step)
|
||||||
24
misc/all-hosts.yaml
Normal file
24
misc/all-hosts.yaml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
all:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3.12
|
||||||
|
|
||||||
|
database:
|
||||||
|
hosts:
|
||||||
|
db_01:
|
||||||
|
ansible_host: 192.168.11.20
|
||||||
|
ansible_connection: ssh
|
||||||
|
ansible_user: vagrant
|
||||||
|
ansible_ssh_password: vagrant
|
||||||
|
loadbalancer:
|
||||||
|
hosts:
|
||||||
|
lb_01:
|
||||||
|
ansible_host: 192.168.11.30
|
||||||
|
ansible_connection: ssh
|
||||||
|
ansible_user: vagrant
|
||||||
|
ansible_ssh_password: vagrant
|
||||||
|
webserver:
|
||||||
|
hosts:
|
||||||
|
db_01:
|
||||||
|
ansible_host: 192.168.11.40
|
||||||
|
ansible_connection: ssh
|
||||||
|
ansible_user: vagrant
|
||||||
|
ansible_ssh_password: vagrant
|
||||||
Reference in New Issue
Block a user