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,10 +1,8 @@
- block: - name: Gather service facts
- name: Gather service facts
ansible.builtin.service_facts: ansible.builtin.service_facts:
# Module requires no attributes # Module requires no attributes
- name: Install K3s - name: Install K3s
ansible.builtin.command: ansible.builtin.command:
cmd: ./install.sh cmd: ./install.sh
chdir: /opt/metacluster/k3s chdir: /opt/metacluster/k3s
@ -13,7 +11,7 @@
INSTALL_K3S_EXEC: 'server --cluster-init --disable local-storage' INSTALL_K3S_EXEC: 'server --cluster-init --disable local-storage'
when: ansible_facts.services['k3s.service'] is undefined when: ansible_facts.services['k3s.service'] is undefined
- name: Ensure API availability - name: Ensure API availability
ansible.utils.cli_parse: ansible.utils.cli_parse:
command: curl -k https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose command: curl -k https://{{ vapp['guestinfo.ipaddress'] }}:6443/livez?verbose
parser: parser:
@ -24,24 +22,41 @@
retries: 3 retries: 3
delay: 30 delay: 30
- name: Initialize tempfile - name: Install kubectl tab-completion
ansible.builtin.shell:
cmd: kubectl completion bash | tee /etc/bash_completion.d/kubectl
- 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: Import container images
ansible.builtin.command:
cmd: k3s ctr image import {{ item }}
chdir: /opt/metacluster/container-images
loop: "{{ imagetarballs.files }}"
- name: Initialize tempfile
ansible.builtin.tempfile: ansible.builtin.tempfile:
state: file state: file
register: kubeconfig register: kubeconfig
- name: Retrieve kubeconfig - name: Retrieve kubeconfig
ansible.builtin.command: ansible.builtin.command:
cmd: kubectl config view --raw cmd: kubectl config view --raw
register: kubectl_config register: kubectl_config
- name: Store kubeconfig in tempfile - name: Store kubeconfig in tempfile
ansible.builtin.copy: ansible.builtin.copy:
dest: "{{ kubeconfig.path }}" dest: "{{ kubeconfig.path }}"
content: "{{ kubectl_config.stdout }}" content: "{{ kubectl_config.stdout }}"
mode: 0600 mode: 0600
no_log: true no_log: true
- name: Configure traefik dashboard ingress - name: Configure traefik dashboard ingress
ansible.builtin.template: ansible.builtin.template:
src: ingressroute.j2 src: ingressroute.j2
dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml dest: /var/lib/rancher/k3s/server/manifests/{{ _template.name }}-manifest.yaml
@ -65,28 +80,9 @@
notify: notify:
- Apply manifests - Apply manifests
- name: Trigger handlers - name: Trigger handlers
ansible.builtin.meta: flush_handlers ansible.builtin.meta: flush_handlers
- name: Install kubectl tab-completion
ansible.builtin.shell:
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: Import container images
ansible.builtin.command:
cmd: k3s ctr image import {{ item }}
chdir: /opt/metacluster/container-images
loop: "{{ imagetarballs.files }}"
- name: Create component entries in /etc/hosts - name: Create component entries in /etc/hosts
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/hosts path: /etc/hosts