mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
103 lines
3.0 KiB
YAML
103 lines
3.0 KiB
YAML
---
|
|
- name: Include pre-flight checks
|
|
ansible.builtin.include_tasks: preflight.yml
|
|
|
|
- name: Create _sources directory
|
|
ansible.builtin.file:
|
|
path: "{{ sources_dest }}"
|
|
state: 'directory'
|
|
mode: '0700'
|
|
|
|
- name: debug minikube_setup
|
|
ansible.builtin.debug:
|
|
var: minikube_setup
|
|
|
|
# Linux block
|
|
- block:
|
|
- name: Download Minikube
|
|
ansible.builtin.get_url:
|
|
url: "{{ minikube_url_linux }}"
|
|
dest: "{{ sources_dest }}/minikube"
|
|
mode: 0755
|
|
|
|
- name: Download Kubectl
|
|
ansible.builtin.get_url:
|
|
url: "{{ kubectl_url_linux }}"
|
|
dest: "{{ sources_dest }}/kubectl"
|
|
mode: 0755
|
|
when:
|
|
- ansible_architecture == "x86_64"
|
|
- ansible_system == "Linux"
|
|
- minikube_setup | default(False) | bool
|
|
|
|
# MacOS block
|
|
- block:
|
|
- name: Download Minikube
|
|
ansible.builtin.get_url:
|
|
url: "{{ minikube_url_macos }}"
|
|
dest: "{{ sources_dest }}/minikube"
|
|
mode: 0755
|
|
|
|
- name: Download Kubectl
|
|
ansible.builtin.get_url:
|
|
url: "{{ kubectl_url_macos }}"
|
|
dest: "{{ sources_dest }}/kubectl"
|
|
mode: 0755
|
|
when:
|
|
- ansible_architecture == "x86_64"
|
|
- ansible_system == "Darwin"
|
|
- minikube_setup | default(False) | bool
|
|
|
|
- block:
|
|
- name: Starting Minikube
|
|
ansible.builtin.shell: "{{ sources_dest }}/minikube start --driver={{ driver }} --install-addons=true --addons={{ addons | join(',') }}"
|
|
register: minikube_stdout
|
|
|
|
- name: Enable Ingress Controller on Minikube
|
|
ansible.builtin.shell: "{{ sources_dest }}/minikube addons enable ingress"
|
|
when:
|
|
- minikube_stdout.rc == 0
|
|
register: _minikube_ingress
|
|
ignore_errors: true
|
|
|
|
- name: Show Minikube Ingress known-issue 7332 warning
|
|
ansible.builtin.pause:
|
|
seconds: 5
|
|
prompt: "The Minikube Ingress addon has been disabled since it looks like you are hitting https://github.com/kubernetes/minikube/issues/7332"
|
|
when:
|
|
- '"minikube/issues/7332" in _minikube_ingress.stderr'
|
|
- ansible_system == "Darwin"
|
|
when:
|
|
- minikube_setup | default(False) | bool
|
|
|
|
- name: Create ServiceAccount and clusterRoleBinding
|
|
k8s:
|
|
apply: true
|
|
definition: "{{ lookup('template', 'rbac.yml.j2') }}"
|
|
|
|
- name: Retrieve serviceAccount secret name
|
|
k8s_info:
|
|
kind: ServiceAccount
|
|
namespace: '{{ minikube_service_account_namespace }}'
|
|
name: '{{ minikube_service_account_name }}'
|
|
register: service_account
|
|
|
|
- name: Retrieve bearer_token from serviceAccount secret
|
|
k8s_info:
|
|
kind: Secret
|
|
namespace: '{{ minikube_service_account_namespace }}'
|
|
name: '{{ minikube_service_account_name }}'
|
|
register: _service_account_secret
|
|
|
|
- name: Load Minikube Bearer Token
|
|
ansible.builtin.set_fact:
|
|
service_account_token: '{{ _service_account_secret["resources"][0]["data"]["token"] | b64decode }}'
|
|
when:
|
|
- _service_account_secret["resources"][0]["data"] | length
|
|
|
|
- name: Render minikube credential JSON template
|
|
ansible.builtin.template:
|
|
src: bootstrap_minikube.py.j2
|
|
dest: "{{ sources_dest }}/bootstrap_minikube.py"
|
|
mode: '0600'
|