Playbook #1

/root/kubeinit/ci/builds/bsU8uCNn/0/kubeinit/kubeinit/kubeinit-aux/kubeinit/playbook.yml

Report Status CLI Date Duration Controller User Versions Hosts Plays Tasks Results Files Records
05 May 2024 02:26:21 +0000 00:10:30.34 nyctea root Ansible 2.15.2 ara 1.6.1 (client), 1.6.1 (server) Python 3.11.4 6 11 745 812 43 1

File: /root/.ansible/collections/ansible_collections/kubeinit/kubeinit/roles/kubeinit_k8s/tasks/prepare_cluster.yml

---
# Copyright kubeinit contributors
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

- name: Setup the cluster provision container
  ansible.builtin.include_role:
    name: kubeinit.kubeinit.kubeinit_services
    tasks_from: create_provision_container.yml
  vars:
    kubeinit_deployment_node_name: "{{ kubeinit_provision_service_node }}"
    kubeinit_deployment_pod_name: "{{ hostvars[kubeinit_provision_service_node].guest_name }}-pod"
    kubeinit_deployment_delegate: "{{ hostvars[kubeinit_provision_service_node].target }}"
    kubeinit_deployment_os: "{{ hostvars[kubeinit_provision_service_node].os }}"

- name: Configure the service node
  block:

    - name: Remove repo before adding it
      ansible.builtin.file:
        path: /etc/yum.repos.d/kubernetes.repo
        state: absent

    - name: Creating a repository file for Kubernetes
      ansible.builtin.file:
        path: /etc/yum.repos.d/kubernetes.repo
        state: touch
        mode: '0644'

    - name: Adding repository details in Kubernetes repo file.
      ansible.builtin.blockinfile:
        path: /etc/yum.repos.d/kubernetes.repo
        block: |
         [kubernetes]
         name=Kubernetes
         baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$basearch
         enabled=1
         gpgcheck=1
         repo_gpgcheck=1
         gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
         exclude=kubelet kubeadm kubectl

    - name: Install requirements
      ansible.builtin.command: dnf install -y kubectl-{{ kubeinit_k8s_kubernetes_version }}.* --disableexcludes=kubernetes
      register: _result
      changed_when: "_result.rc == 0"

    - name: Install common requirements
      ansible.builtin.package:
        name: "{{ kubeinit_k8s_common_dependencies }}"
        state: present
      when: kubeinit_k8s_common_dependencies is defined

  delegate_to: "{{ kubeinit_provision_service_node }}"