You've already forked ansible-awx-gitlab
initial commit
This commit is contained in:
12
roles/awx_operator/defaults/main.yml
Normal file
12
roles/awx_operator/defaults/main.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
# Check the current release tag before rollout:
|
||||
# https://github.com/ansible/awx-operator/releases
|
||||
awx_operator_version: "2.19.1"
|
||||
awx_operator_namespace: "awx"
|
||||
awx_operator_name: "awx"
|
||||
awx_operator_admin_user: "admin"
|
||||
awx_operator_service_type: "NodePort"
|
||||
awx_operator_nodeport: 30080
|
||||
awx_operator_postgres_storage_size: "8Gi"
|
||||
awx_operator_web_replicas: 1
|
||||
awx_operator_task_replicas: 1
|
||||
73
roles/awx_operator/tasks/main.yml
Normal file
73
roles/awx_operator/tasks/main.yml
Normal file
@@ -0,0 +1,73 @@
|
||||
---
|
||||
- name: Create the AWX namespace
|
||||
kubernetes.core.k8s:
|
||||
name: "{{ awx_operator_namespace }}"
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
state: present
|
||||
tags: [awx_operator]
|
||||
|
||||
- name: Deploy the AWX Operator (pinned version)
|
||||
ansible.builtin.command: >
|
||||
/usr/local/bin/k3s kubectl apply -k
|
||||
github.com/ansible/awx-operator/config/default?ref={{ awx_operator_version }}
|
||||
environment:
|
||||
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
|
||||
register: awx_operator_deploy_result
|
||||
changed_when: "'unchanged' not in awx_operator_deploy_result.stdout"
|
||||
tags: [awx_operator]
|
||||
|
||||
- name: Set the operator's default namespace annotation
|
||||
ansible.builtin.command: >
|
||||
/usr/local/bin/k3s kubectl config set-context --current --namespace={{ awx_operator_namespace }}
|
||||
environment:
|
||||
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
|
||||
changed_when: true
|
||||
tags: [awx_operator]
|
||||
|
||||
- name: Wait for the AWX Operator deployment to become available
|
||||
ansible.builtin.command: >
|
||||
/usr/local/bin/k3s kubectl wait deployment/awx-operator-controller-manager
|
||||
-n {{ awx_operator_namespace }} --for=condition=Available --timeout=300s
|
||||
environment:
|
||||
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
|
||||
changed_when: false
|
||||
tags: [awx_operator]
|
||||
|
||||
- name: Create the AWX admin password secret
|
||||
kubernetes.core.k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: "{{ awx_operator_name }}-admin-password"
|
||||
namespace: "{{ awx_operator_namespace }}"
|
||||
type: Opaque
|
||||
stringData:
|
||||
password: "{{ awx_admin_password }}"
|
||||
no_log: true
|
||||
tags: [awx_operator]
|
||||
|
||||
- name: Deploy the AWX custom resource
|
||||
kubernetes.core.k8s:
|
||||
state: present
|
||||
definition: "{{ lookup('ansible.builtin.template', 'awx-instance.yml.j2') }}"
|
||||
tags: [awx_operator]
|
||||
|
||||
- name: Wait for the AWX web deployment to become available
|
||||
ansible.builtin.command: >
|
||||
/usr/local/bin/k3s kubectl wait deployment/{{ awx_operator_name }}-web
|
||||
-n {{ awx_operator_namespace }} --for=condition=Available --timeout=900s
|
||||
environment:
|
||||
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
|
||||
changed_when: false
|
||||
register: awx_operator_web_ready
|
||||
tags: [awx_operator]
|
||||
|
||||
- name: Report AWX access details
|
||||
ansible.builtin.debug:
|
||||
msg: >-
|
||||
AWX is reachable at http://{{ ansible_host | default(inventory_hostname) }}:{{ awx_operator_nodeport }}
|
||||
with user '{{ awx_operator_admin_user }}'. Password is stored in vault/secrets.yml (awx_admin_password).
|
||||
tags: [awx_operator]
|
||||
17
roles/awx_operator/templates/awx-instance.yml.j2
Normal file
17
roles/awx_operator/templates/awx-instance.yml.j2
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: awx.ansible.com/v1beta1
|
||||
kind: AWX
|
||||
metadata:
|
||||
name: {{ awx_operator_name }}
|
||||
namespace: {{ awx_operator_namespace }}
|
||||
spec:
|
||||
service_type: {{ awx_operator_service_type }}
|
||||
{% if awx_operator_service_type == "NodePort" %}
|
||||
nodeport_port: {{ awx_operator_nodeport }}
|
||||
{% endif %}
|
||||
admin_user: {{ awx_operator_admin_user }}
|
||||
admin_password_secret: {{ awx_operator_name }}-admin-password
|
||||
postgres_storage_requirements:
|
||||
requests:
|
||||
storage: {{ awx_operator_postgres_storage_size }}
|
||||
web_replicas: {{ awx_operator_web_replicas }}
|
||||
task_replicas: {{ awx_operator_task_replicas }}
|
||||
Reference in New Issue
Block a user