Skip to content

Instantly share code, notes, and snippets.

from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os
import tempfile
from ansible_collections.ansible.posix.tests.unit.compat import unittest
from ansible_collections.ansible.posix.tests.unit.compat.mock import patch, MagicMock
test playbook test_import_include.yml:
- hosts: localhost
gather_facts: false
vars:
interface: test_interface
test_import_include:
- name: "{{ interface }}"
state: up
type: ethernet
- hosts: localhost
vars:
result:
vpc:
cidr_block_association_set:
- id: block1
cidr_block: 192.168.122.0/24
cidr_block_state:
state: present
- id: block2
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build file",
"type": "shell",
"command": "gfortran -o ${file}.exe ${file}",
"problemMatcher": [],
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build hello world",
"type": "shell",
"command": "gfortran -o hello helloworld.f90",
"problemMatcher": [],
- hosts: localhost
vars:
nodenames: [node1, node2, node3]
tasks:
- name: add nodes
add_host:
name: "{{ item }}"
foo: bar
ha_cluster:
node_name: "{{ item ~ '-ha' }}"
I used the following inventory:
all:
hosts:
host1.local:
host2.local:
host3.local:
host4.local:
vars:
vpn_connections:
from kubernetes import client, config
from openshift.dynamic import DynamicClient
k8s_client = config.new_client_from_config()
dyn_client = DynamicClient(k8s_client)
v1_projects = dyn_client.resources.get(api_version='project.openshift.io/v1', kind='Project')
project_list = v1_projects.get()
- name: set collection paths
set_fact:
collection_paths: |
{{
(lookup("env","ANSIBLE_COLLECTIONS_PATH").split(":") +
lookup("env","ANSIBLE_COLLECTIONS_PATHS").split(":") +
lookup("config", "COLLECTIONS_PATHS")) |
select | list
}}