Skip to content

Instantly share code, notes, and snippets.

@consolewitch
Last active May 18, 2018 18:37
Show Gist options
  • Save consolewitch/fee7ccc9b4809b6dc3a8a80ad0adc9ad to your computer and use it in GitHub Desktop.
Save consolewitch/fee7ccc9b4809b6dc3a8a80ad0adc9ad to your computer and use it in GitHub Desktop.
deploy Kubernetes manifests with ansible (broken)
# This is *a* way to deploy kubernetes manifests with ansible but it doesn't currently work very well..
# the python library that ansible uses to call kubernetes isn't up to date. See the following link for details
# https://github.com/ansible/ansible/issues/36676#event-1510125400
#- name: "install requirements for ansible k8s_raw module"
# pip:
# name: "{{ item.name }}"
# version: "{{ item.version }}"
# state: present with_items:
# - { name: "openshift", version: "0.5.0" }
# - { name: "pyyaml", version: "3.12" }
#
#- name: "Get a list of the jinja2 templates"
# delegate_to: 127.0.0.1
# become: false
# find:
# paths: "{{ role_path }}/templates/"
# patterns: '*.j2'
# register: kubernetes_manifest_templates
#
#- name: "Install the manifests"
# template:
# src: "{{ item.path }}"
# dest: /opt/manifests/{{ item.path | basename | regex_replace('\.j2','') }}
# loop: "{{ kubernetes_manifest_templates.files }}"
#
#- name: "Get a list of the kubernetes service manifests on the target"
# find:
# paths: "/opt/manifests/"
# use_regex: true
# patterns: '^service-.*(\.yaml|\.yml)$'
# register: kubernetes_service_manifests
#
#- name: "Install kubernetes service manifests"
# k8s_raw:
# state: present
# kubeconfig: "/home/user/.kube/config" ## this needs to be parameterized
# src: "{{ item.path }}"
# loop: "{{ kubernetes_service_manifests.files }}"
#
#- name: "Get a list of the kubernetes deployment manifests on the target"
# find:
# paths: "/opt/manifests/"
# use_regex: true
# patterns: '^deployment-.*(\.yaml|\.yml)$'
# register: kubernetes_deployment_manifests
#
#- name: "Install kubernetes deployment manifests"
# k8s_raw:
# state: present
# kubeconfig: "/home/user/.kube/config" ## this needs to be parameterized
# src: "{{ item.path }}"
# loop: "{{ kubernetes_deployment_manifests.files }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment