From d084bc8f4e6e67e5d61a4bab22711a1faa6ba824 Mon Sep 17 00:00:00 2001 From: Radar231 Date: Tue, 19 Oct 2021 20:15:55 -0400 Subject: [PATCH] initial checkin --- README.md | 8 ++++++++ meta/main.yml | 9 +++++++++ tasks/main.yml | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 README.md create mode 100644 meta/main.yml create mode 100644 tasks/main.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..069009c --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# Ansible Role: k8s_metallb_deploy + +## Introduction + +This role will deploy the metallb load-balancer. + +This role requires that the 'devpath' variable be set. + diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..eb37897 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,9 @@ +galaxy_info: + author: radar231 + + license: license (GPL-2.0-or-later, MIT, etc) + min_ansible_version: 2.1 + galaxy_tags: [] +dependencies: [] + +# EOF diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..ea5817e --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,51 @@ +--- +##################################################################### +# +# metallb_deploy role +# +# - requires that the 'devpath' and 'metallb_ver' variables be set +# +##################################################################### +# tasks file for metallb_deploy role + +- debug: msg="Deploying metallb load-balancer." + +- name: Retrieve the metallb 'namespace.yaml' manifest + ansible.builtin.get_url: + url: "https://raw.githubusercontent.com/metallb/metallb/{{ metallb_ver }}/manifests/namespace.yaml" + dest: "/tmp/namespace.yaml" + mode: '0644' + +- name: Apply metallb 'namespace.yaml' manifest + community.kubernetes.k8s: + state: present + src: "/tmp/namespace.yaml" + +- name: Delete retrieved 'namespace.yaml' manifest file + ansible.builtin.file: + path: "/tmp/namespace.yaml" + state: absent + +- name: Retrieve the metallb 'metallb.yaml' manifest + ansible.builtin.get_url: + url: "https://raw.githubusercontent.com/metallb/metallb/{{ metallb_ver }}/manifests/metallb.yaml" + dest: "/tmp/metallb.yaml" + mode: '0644' + +- name: Apply metallb 'metallb.yaml' manifest + community.kubernetes.k8s: + state: present + src: "/tmp/metallb.yaml" + +- name: Delete retrieved 'metallb.yaml' manifest file + ansible.builtin.file: + path: "/tmp/metallb.yaml" + state: absent + +- name: Create metallb configmap object + community.kubernetes.k8s: + state: present + namespace: metallb-system + src: "{{ devpath }}/k8s_metallb/metallb_configmap.yml" + +# EOF