Loading ansible/playbooks/00-install-python-deps.yml +15 −1 Original line number Diff line number Diff line Loading @@ -12,13 +12,27 @@ venv_path: "/opt/ansible-venv" tasks: - name: Wait for apt lock to be released ansible.builtin.shell: | while fuser /var/lib/dpkg/lock >/dev/null 2>&1 || fuser /var/lib/apt/lists/lock >/dev/null 2>&1; do sleep 1; done changed_when: false ignore_errors: true - name: Update apt cache ansible.builtin.apt: update_cache: true cache_valid_time: 3600 register: apt_action retries: 10 delay: 5 until: apt_action is success - name: Install Python3 venv package ansible.builtin.apt: name: - python3-venv - python3-pip state: present update_cache: true - name: Create virtual environment ansible.builtin.command: Loading ansible/playbooks/00-setup-docker.yml +2 −6 Original line number Diff line number Diff line Loading @@ -43,17 +43,15 @@ state: absent loop: - /etc/apt/sources.list.d/docker.list - /etc/apt/sources.list.d/docker.sources - /etc/apt/keyrings/docker.gpg - /etc/apt/keyrings/docker.asc when: docker_check.rc != 0 - name: Add Docker's official GPG key ansible.builtin.shell: cmd: | curl -fsSL https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg curl -fsSL https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg chmod a+r /etc/apt/keyrings/docker.gpg creates: /etc/apt/keyrings/docker.gpg when: docker_check.rc != 0 - name: Add Docker repository ansible.builtin.shell: Loading @@ -62,8 +60,6 @@ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/{{ ansible_distribution | lower }} \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null creates: /etc/apt/sources.list.d/docker.list when: docker_check.rc != 0 - name: Update apt cache again ansible.builtin.apt: Loading ansible/playbooks/00-setup-kubectl.yml +5 −6 Original line number Diff line number Diff line Loading @@ -32,15 +32,14 @@ - name: Download Kubernetes public signing key ansible.builtin.shell: cmd: | curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | gpg --dearmor --yes -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg chmod a+r /etc/apt/keyrings/kubernetes-apt-keyring.gpg creates: /etc/apt/keyrings/kubernetes-apt-keyring.gpg - name: Add Kubernetes repository ansible.builtin.shell: cmd: | echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list creates: /etc/apt/sources.list.d/kubernetes.list ansible.builtin.copy: content: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /\n" dest: /etc/apt/sources.list.d/kubernetes.list mode: '0644' - name: Update apt cache again ansible.builtin.apt: Loading ansible/roles/kind-cluster/tasks/cluster.yml +11 −11 Original line number Diff line number Diff line Loading @@ -135,11 +135,20 @@ dest: "{{ kind_config_dir }}/{{ kubeconfig_filename }}" mode: '0600' - name: Get host IP for reference ansible.builtin.command: hostname -I register: host_ip_result changed_when: false - name: Extract first IP address ansible.builtin.set_fact: primary_host_ip: "{{ host_ip_result.stdout.split()[0] }}" - name: Update kubeconfig server address (0.0.0.0 to host IP for remote access) ansible.builtin.replace: path: "{{ kind_config_dir }}/{{ kubeconfig_filename }}" regexp: '0\.0\.0\.0' replace: "{{ host_ip | default(kubeconfig_server_host) }}" replace: "{{ primary_host_ip | default(kubeconfig_server_host) }}" - name: Read final kubeconfig to get the port ansible.builtin.shell: | Loading @@ -147,15 +156,6 @@ register: kind_port changed_when: false - name: Get host IP for reference ansible.builtin.command: hostname -I register: host_ip changed_when: false - name: Extract first IP address ansible.builtin.set_fact: primary_host_ip: "{{ host_ip.stdout.split()[0] }}" - name: Verify cluster access with kubectl ansible.builtin.command: kubectl get nodes environment: Loading Loading @@ -186,7 +186,7 @@ {% if deployment_mode is defined and deployment_mode == 'remote' %} Local kubeconfig: {{ kubeconfig_output_dir }}/{{ kubeconfig_filename }} {% endif %} Server URL: https://{{ host_ip | default(kubeconfig_server_host) }}:{{ kind_port.stdout }} Server URL: https://{{ primary_host_ip | default(kubeconfig_server_host) }}:{{ kind_port.stdout }} Nodes: - 1 control-plane node Loading Loading
ansible/playbooks/00-install-python-deps.yml +15 −1 Original line number Diff line number Diff line Loading @@ -12,13 +12,27 @@ venv_path: "/opt/ansible-venv" tasks: - name: Wait for apt lock to be released ansible.builtin.shell: | while fuser /var/lib/dpkg/lock >/dev/null 2>&1 || fuser /var/lib/apt/lists/lock >/dev/null 2>&1; do sleep 1; done changed_when: false ignore_errors: true - name: Update apt cache ansible.builtin.apt: update_cache: true cache_valid_time: 3600 register: apt_action retries: 10 delay: 5 until: apt_action is success - name: Install Python3 venv package ansible.builtin.apt: name: - python3-venv - python3-pip state: present update_cache: true - name: Create virtual environment ansible.builtin.command: Loading
ansible/playbooks/00-setup-docker.yml +2 −6 Original line number Diff line number Diff line Loading @@ -43,17 +43,15 @@ state: absent loop: - /etc/apt/sources.list.d/docker.list - /etc/apt/sources.list.d/docker.sources - /etc/apt/keyrings/docker.gpg - /etc/apt/keyrings/docker.asc when: docker_check.rc != 0 - name: Add Docker's official GPG key ansible.builtin.shell: cmd: | curl -fsSL https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg curl -fsSL https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg | gpg --dearmor --yes -o /etc/apt/keyrings/docker.gpg chmod a+r /etc/apt/keyrings/docker.gpg creates: /etc/apt/keyrings/docker.gpg when: docker_check.rc != 0 - name: Add Docker repository ansible.builtin.shell: Loading @@ -62,8 +60,6 @@ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/{{ ansible_distribution | lower }} \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null creates: /etc/apt/sources.list.d/docker.list when: docker_check.rc != 0 - name: Update apt cache again ansible.builtin.apt: Loading
ansible/playbooks/00-setup-kubectl.yml +5 −6 Original line number Diff line number Diff line Loading @@ -32,15 +32,14 @@ - name: Download Kubernetes public signing key ansible.builtin.shell: cmd: | curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | gpg --dearmor --yes -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg chmod a+r /etc/apt/keyrings/kubernetes-apt-keyring.gpg creates: /etc/apt/keyrings/kubernetes-apt-keyring.gpg - name: Add Kubernetes repository ansible.builtin.shell: cmd: | echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list creates: /etc/apt/sources.list.d/kubernetes.list ansible.builtin.copy: content: "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /\n" dest: /etc/apt/sources.list.d/kubernetes.list mode: '0644' - name: Update apt cache again ansible.builtin.apt: Loading
ansible/roles/kind-cluster/tasks/cluster.yml +11 −11 Original line number Diff line number Diff line Loading @@ -135,11 +135,20 @@ dest: "{{ kind_config_dir }}/{{ kubeconfig_filename }}" mode: '0600' - name: Get host IP for reference ansible.builtin.command: hostname -I register: host_ip_result changed_when: false - name: Extract first IP address ansible.builtin.set_fact: primary_host_ip: "{{ host_ip_result.stdout.split()[0] }}" - name: Update kubeconfig server address (0.0.0.0 to host IP for remote access) ansible.builtin.replace: path: "{{ kind_config_dir }}/{{ kubeconfig_filename }}" regexp: '0\.0\.0\.0' replace: "{{ host_ip | default(kubeconfig_server_host) }}" replace: "{{ primary_host_ip | default(kubeconfig_server_host) }}" - name: Read final kubeconfig to get the port ansible.builtin.shell: | Loading @@ -147,15 +156,6 @@ register: kind_port changed_when: false - name: Get host IP for reference ansible.builtin.command: hostname -I register: host_ip changed_when: false - name: Extract first IP address ansible.builtin.set_fact: primary_host_ip: "{{ host_ip.stdout.split()[0] }}" - name: Verify cluster access with kubectl ansible.builtin.command: kubectl get nodes environment: Loading Loading @@ -186,7 +186,7 @@ {% if deployment_mode is defined and deployment_mode == 'remote' %} Local kubeconfig: {{ kubeconfig_output_dir }}/{{ kubeconfig_filename }} {% endif %} Server URL: https://{{ host_ip | default(kubeconfig_server_host) }}:{{ kind_port.stdout }} Server URL: https://{{ primary_host_ip | default(kubeconfig_server_host) }}:{{ kind_port.stdout }} Nodes: - 1 control-plane node Loading