How to manage K8s objects with Ansible from src URL not local file?

1/9/2020

I am trying to use Terraform to deploy a Kubernetes Cluster and Ansible for deploying K8s objects. Everything works, using Ansible K8s, also deploying from local YAML files, but when I try to use lookup from url like described here I get an error:

ERROR! A worker was found in a dead state

Part of the Ansible Tasks:

- name: Fip-Controller rbac
  k8s:
    api_key: "{{ api_token }}"
    host: "{{ api_url }}"
    state: present
    definition: "{{ item }}"
  with_items: "{{lookup('url', 'https://raw.githubusercontent.com/cbeneke/hcloud-fip-controller/master/deploy/rbac.yaml', split_lines=False) | from_yaml_all | list}}"
  when: item is not none

I also tried the exact same like described here (same link as above).

A related Github issue with the same error

I would be grateful if anybody could point me in any direction. Is there a better solution for adding YAMLs from urls?

Ansible: v2.9.1
OS: macOS Mojave

-- Espen Finnesand
ansible
ansible-tasks
kubernetes
terraform

1 Answer

1/19/2020

There is a known problem with using some Python packages under OSX. Exporting this variable solved my problem:

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

See this issue

-- Espen Finnesand
Source: StackOverflow