Обновить ansible/deploy_awx_k8s.yml
This commit is contained in:
@@ -6,12 +6,15 @@
|
|||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
# Простые fallback-значения (переопределяются Semaphore Variable Group)
|
# Основные параметры — переопределяй в Semaphore Variable Group
|
||||||
awx_namespace: awx
|
awx_namespace: awx
|
||||||
awx_instance_name: awx
|
awx_instance_name: awx
|
||||||
awx_service_type: NodePort # NodePort / ClusterIP / LoadBalancer
|
awx_service_type: NodePort # NodePort / ClusterIP / LoadBalancer
|
||||||
awx_operator_version: 2.19.1 # Последняя стабильная на конец 2025
|
awx_operator_version: 2.19.1 # Последняя стабильная на декабрь 2025
|
||||||
kubeconfig_path: "/home/semaphore/.kube/config"
|
kubeconfig_path: "/home/semaphore/.kube/config"
|
||||||
|
awx_storage_class: local-path # Предполагаем k3s или аналогичный кластер с local-path provisioner. Изменить на свой SC
|
||||||
|
awx_projects_persistence: false # Отключаем persistence для projects для теста (чтобы избежать PVC проблем)
|
||||||
|
awx_projects_storage_size: 8Gi # Если persistence: true
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Fail if kubeconfig not found inside container
|
- name: Fail if kubeconfig not found inside container
|
||||||
@@ -56,6 +59,21 @@
|
|||||||
retries: 40
|
retries: 40
|
||||||
delay: 15
|
delay: 15
|
||||||
|
|
||||||
|
- name: Ensure default StorageClass for persistence (assume local-path for k3s-like clusters)
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
state: present
|
||||||
|
kubeconfig: "{{ kubeconfig_path }}"
|
||||||
|
definition:
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: "{{ awx_storage_class }}"
|
||||||
|
annotations:
|
||||||
|
storageclass.kubernetes.io/is-default-class: "true"
|
||||||
|
provisioner: rancher.io/local-path # Для k3s; изменить на свой provisioner (e.g., kubernetes.io/no-provisioner)
|
||||||
|
reclaimPolicy: Delete
|
||||||
|
volumeBindingMode: WaitForFirstConsumer # Избежать immediate bind ошибок на multi-node
|
||||||
|
|
||||||
- name: Deploy AWX instance
|
- name: Deploy AWX instance
|
||||||
kubernetes.core.k8s:
|
kubernetes.core.k8s:
|
||||||
state: present
|
state: present
|
||||||
@@ -68,8 +86,12 @@
|
|||||||
namespace: "{{ awx_namespace }}"
|
namespace: "{{ awx_namespace }}"
|
||||||
spec:
|
spec:
|
||||||
service_type: "{{ awx_service_type }}"
|
service_type: "{{ awx_service_type }}"
|
||||||
|
postgres_storage_class: "{{ awx_storage_class }}" # Указываем SC для postgres PVC
|
||||||
|
projects_persistence: "{{ awx_projects_persistence }}" # false для теста, чтобы избежать дополнительного PVC
|
||||||
|
projects_storage_class: "{{ awx_storage_class }}" # Если persistence: true
|
||||||
|
projects_storage_size: "{{ awx_projects_storage_size }}"
|
||||||
|
|
||||||
- name: Wait for AWX pods to be running
|
- name: Wait for AWX pods to be running (increased retries for slow storage provisioning)
|
||||||
kubernetes.core.k8s_info:
|
kubernetes.core.k8s_info:
|
||||||
kubeconfig: "{{ kubeconfig_path }}"
|
kubeconfig: "{{ kubeconfig_path }}"
|
||||||
kind: Pod
|
kind: Pod
|
||||||
@@ -79,7 +101,7 @@
|
|||||||
register: awx_pods
|
register: awx_pods
|
||||||
until: >-
|
until: >-
|
||||||
awx_pods.resources | selectattr('status.phase', 'equalto', 'Running') | list | length >= 2
|
awx_pods.resources | selectattr('status.phase', 'equalto', 'Running') | list | length >= 2
|
||||||
retries: 60
|
retries: 90 # Увеличено для ожидания provisioning PVC/PV
|
||||||
delay: 20
|
delay: 20
|
||||||
|
|
||||||
- name: Retrieve AWX admin password
|
- name: Retrieve AWX admin password
|
||||||
@@ -99,3 +121,4 @@
|
|||||||
(get port: kubectl get svc {{ awx_instance_name }}-service -n {{ awx_namespace }})
|
(get port: kubectl get svc {{ awx_instance_name }}-service -n {{ awx_namespace }})
|
||||||
Username: admin
|
Username: admin
|
||||||
Password: {{ awx_secret.resources[0].data.password | b64decode }}
|
Password: {{ awx_secret.resources[0].data.password | b64decode }}
|
||||||
|
Note: If persistence issues persist, ensure your cluster has a working provisioner (e.g., local-path in k3s) and default StorageClass set.
|
||||||
Reference in New Issue
Block a user