Change order (test timing of handler)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2022-08-19 12:55:53 +02:00
parent fe306bd845
commit 5f1d1bfa8a

View File

@ -1,91 +1,87 @@
- block: - name: Gather service facts
ansible.builtin.service_facts:
# Module requires no attributes
- name: Gather service facts - name: Install K3s
ansible.builtin.service_facts: ansible.builtin.command:
# Module requires no attributes cmd: ./install.sh
chdir: /opt/metacluster/k3s
environment:
INSTALL_K3S_SKIP_DOWNLOAD: 'true'
INSTALL_K3S_EXEC: 'server --cluster-init --disable local-storage'
when: ansible_facts.services['k3s.service'] is undefined
- name: Install K3s - name: Ensure API availability
ansible.builtin.command: ansible.utils.cli_parse:
cmd: ./install.sh command: curl -k https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose
chdir: /opt/metacluster/k3s parser:
environment: name: ansible.utils.json
INSTALL_K3S_SKIP_DOWNLOAD: 'true' set_fact: api_readycheck
INSTALL_K3S_EXEC: 'server --cluster-init --disable local-storage' ignore_errors: yes
when: ansible_facts.services['k3s.service'] is undefined until: api_readycheck.apiVersion is defined
retries: 3
- name: Ensure API availability delay: 30
ansible.utils.cli_parse:
command: curl -k https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose
parser:
name: ansible.utils.json
set_fact: api_readycheck
ignore_errors: yes
until: api_readycheck.apiVersion is defined
retries: 3
delay: 30
- name: Initialize tempfile
ansible.builtin.tempfile:
state: file
register: kubeconfig
- name: Retrieve kubeconfig
ansible.builtin.command:
cmd: kubectl config view --raw
register: kubectl_config
- name: Store kubeconfig in tempfile
ansible.builtin.copy:
dest: "{{ kubeconfig.path }}"
content: "{{ kubectl_config.stdout }}"
mode: 0600
no_log: true
- name: Configure traefik dashboard ingress
ansible.builtin.template:
src: ingressroute.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml
owner: root
group: root
mode: 0600
vars:
_template:
name: traefik-dashboard
namespace: kube-system
config: |2
entryPoints:
- web
- websecure
routes:
- kind: Rule
match: Host(`ingress.{{ vapp['metacluster.fqdn'] }}`)
services:
- kind: TraefikService
name: api@internal
notify:
- Apply manifests
- name: Trigger handlers
ansible.builtin.meta: flush_handlers
- name: Install kubectl tab-completion - name: Install kubectl tab-completion
ansible.builtin.shell: ansible.builtin.shell:
cmd: kubectl completion bash | tee /etc/bash_completion.d/kubectl cmd: kubectl completion bash | tee /etc/bash_completion.d/kubectl
- block: - name: Extract container images
ansible.builtin.unarchive:
src: /opt/metacluster/container-images/image-tarballs.tgz
dest: /opt/metacluster/container-images
list_files: yes
register: imagetarballs
- name: Extract container images - name: Import container images
ansible.builtin.unarchive: ansible.builtin.command:
src: /opt/metacluster/container-images/image-tarballs.tgz cmd: k3s ctr image import {{ item }}
dest: /opt/metacluster/container-images chdir: /opt/metacluster/container-images
list_files: yes loop: "{{ imagetarballs.files }}"
register: imagetarballs
- name: Import container images - name: Initialize tempfile
ansible.builtin.command: ansible.builtin.tempfile:
cmd: k3s ctr image import {{ item }} state: file
chdir: /opt/metacluster/container-images register: kubeconfig
loop: "{{ imagetarballs.files }}"
- name: Retrieve kubeconfig
ansible.builtin.command:
cmd: kubectl config view --raw
register: kubectl_config
- name: Store kubeconfig in tempfile
ansible.builtin.copy:
dest: "{{ kubeconfig.path }}"
content: "{{ kubectl_config.stdout }}"
mode: 0600
no_log: true
- name: Configure traefik dashboard ingress
ansible.builtin.template:
src: ingressroute.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml
owner: root
group: root
mode: 0600
vars:
_template:
name: traefik-dashboard
namespace: kube-system
config: |2
entryPoints:
- web
- websecure
routes:
- kind: Rule
match: Host(`ingress.{{ vapp['metacluster.fqdn'] }}`)
services:
- kind: TraefikService
name: api@internal
notify:
- Apply manifests
- name: Trigger handlers
ansible.builtin.meta: flush_handlers
- name: Create component entries in /etc/hosts - name: Create component entries in /etc/hosts
ansible.builtin.lineinfile: ansible.builtin.lineinfile: