??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó
àUdac @` sž d d l m Z m Z m Z e Z d Z d Z d d l Z d d l m
Z
m Z m
Z
y d d l m Z Wn e k
r} n Xd Z d e f d „ ƒ YZ d S(
i ( t absolute_importt divisiont print_functions
name: kubevirt
plugin_type: inventory
author:
- KubeVirt Team (@kubevirt)
version_added: "2.8"
short_description: KubeVirt inventory source
extends_documentation_fragment:
- inventory_cache
- constructed
description:
- Fetch running VirtualMachines for one or more namespaces.
- Groups by namespace, namespace_vms and labels.
- Uses kubevirt.(yml|yaml) YAML configuration file to set parameter values.
options:
plugin:
description: token that ensures this is a source file for the 'kubevirt' plugin.
required: True
choices: ['kubevirt']
type: str
host_format:
description:
- Specify the format of the host in the inventory group.
default: "{namespace}-{name}-{uid}"
connections:
type: list
description:
- Optional list of cluster connection settings. If no connections are provided, the default
I(~/.kube/config) and active context will be used, and objects will be returned for all namespaces
the active user is authorized to access.
suboptions:
name:
description:
- Optional name to assign to the cluster. If not provided, a name is constructed from the server
and port.
type: str
kubeconfig:
description:
- Path to an existing Kubernetes config file. If not provided, and no other connection
options are provided, the OpenShift client will attempt to load the default
configuration file from I(~/.kube/config.json). Can also be specified via K8S_AUTH_KUBECONFIG
environment variable.
type: str
context:
description:
- The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment
variable.
type: str
host:
description:
- Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.
type: str
api_key:
description:
- Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment
variable.
type: str
username:
description:
- Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME
environment variable.
type: str
password:
description:
- Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD
environment variable.
type: str
cert_file:
description:
- Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE
environment variable.
type: str
key_file:
description:
- Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_HOST
environment variable.
type: str
ssl_ca_cert:
description:
- Path to a CA certificate used to authenticate with the API. Can also be specified via
K8S_AUTH_SSL_CA_CERT environment variable.
type: str
verify_ssl:
description:
- "Whether or not to verify the API server's SSL certificates. Can also be specified via
K8S_AUTH_VERIFY_SSL environment variable."
type: bool
namespaces:
description:
- List of namespaces. If not specified, will fetch all virtual machines for all namespaces user is authorized
to access.
type: list
network_name:
description:
- In case of multiple network attached to virtual machine, define which interface should be returned as primary IP
address.
type: str
api_version:
description:
- "Specify the KubeVirt API version."
type: str
annotation_variable:
description:
- "Specify the name of the annotation which provides data, which should be used as inventory host variables."
- "Note, that the value in ansible annotations should be json."
type: str
default: 'ansible'
requirements:
- "openshift >= 0.6"
- "PyYAML >= 3.11"
sá
# File must be named kubevirt.yaml or kubevirt.yml
# Authenticate with token, and return all virtual machines for all namespaces
plugin: kubevirt
connections:
- host: https://kubevirt.io
token: xxxxxxxxxxxxxxxx
ssl_verify: false
# Use default config (~/.kube/config) file and active context, and return vms with interfaces
# connected to network myovsnetwork and from namespace vms
plugin: kubevirt
connections:
- namespaces:
- vms
network_name: myovsnetwork
N( t K8sInventoryExceptiont InventoryModulet format_dynamic_api_exc( t DynamicApiErrors kubevirt.io/v1alpha3R c B` s; e Z d Z d „ Z d „ Z d d d d „ Z d „ Z RS( t kubevirtc C` s) | | _ t t | ƒ j | | | ƒ d S( N( t config_datat superR t setup( t selfR t cachet cache_key( ( sF /usr/lib/python2.7/site-packages/ansible/plugins/inventory/kubevirt.pyR
s c
C` sQ | j ƒ } | j j d d ƒ } | rù x#| D]Ä } | j | } | j d | j | j j ƒ ƒ } | j d ƒ r€ | d } n | j | ƒ } | j d ƒ } | j d t ƒ } | j d d ƒ } x- | D]% }
| j | | |
| | | | ƒ qÉ Wq. WnT | j | j j ƒ } | j | ƒ } x- | D]% }
| j | | |
| d | | ƒ q$Wd S( Nt host_formats {namespace}-{name}-{uid}t namet
namespacest network_namet api_versiont annotation_variablet ansible(
t get_api_clientR t gett get_default_host_namet
configurationt hostt get_available_namespacest API_VERSIONt get_vms_for_namespacet None( R t connectionst clientt vm_formatt
connectionR R t interface_nameR R t namespace( ( sF /usr/lib/python2.7/site-packages/ansible/plugins/inventory/kubevirt.pyt
fetch_objects¡ s$
!
*
c
` sŒ | j j d | d d ƒ } y | j d | ƒ } Wn9 t k
rl }
| j j |
ƒ t d t |
ƒ ƒ ‚ n Xd j | ƒ } d j | ƒ } | j | ƒ } | j | ƒ } | j | ƒ } | j j
| ƒ | j j
| ƒ | j j | | ƒ | j j
| ƒ | j j | | ƒ xw| j D]l}
|
j
o0|
j
j s9qn ˆ d k rX|
j
j d } n% t ‡ f d † |
j
j Dƒ d ƒ } | d k s| j d k ržqn | j d |
j j d
|
j j d |
j j ƒ } | j } |
j j séi n t |
j j ƒ } | j j | ƒ |
j j rx^ |
j j D]P \ } } d j | | ƒ } | j | ƒ } | j j
| ƒ | j j | | ƒ q$Wt |
j j ƒ } n i } | j j | | ƒ | j j | d
| ƒ | j j | d | ƒ | j j | d | ƒ | j j | d d ƒ | j j | d |
j j ƒ | j j | d |
j j ƒ t j | j | d ƒ ƒ } x0 | j ƒ D]" \ } } | j j | | | ƒ q^WqWd S( NR t kindt VirtualMachineInstanceR# s( Error fetching Virtual Machines list: %ss
namespace_{0}s {0}_vmsi c 3` s$ | ] } | j ˆ k r | Vq d S( N( R ( t .0t i( R" ( sF /usr/lib/python2.7/site-packages/ansible/plugins/inventory/kubevirt.pys Ô s R t uids
label_{0}_{1}t ansible_hostt labelst annotationst object_typet vmt resource_versions {}( t resourcesR R t displayt debugR R t formatt _sanitize_group_namet inventoryt add_groupt add_childt itemst statust
interfacesR t nextt ipAddresst metadataR# R R) R, t dictt add_hostR+ t set_variablet resourceVersiont jsont loads( R R R R# t name_formatR" R R t v1_vmt objt exct namespace_groupt namespace_vms_groupR. t interfacet vm_namet vm_ipt vm_annotationst keyt valuet
group_namet vm_labelst annotations_datat kt v( ( R" sF /usr/lib/python2.7/site-packages/ansible/plugins/inventory/kubevirt.pyR ¸ s` 0 $c C` s2 t t | ƒ j | ƒ r. | j d ƒ r. t Sn t S( Ns kubevirt.ymls
kubevirt.yaml( s kubevirt.ymls
kubevirt.yaml( R R t verify_filet endswitht Truet False( R t path( ( sF /usr/lib/python2.7/site-packages/ansible/plugins/inventory/kubevirt.pyRU ü s N( t __name__t
__module__t NAMER
R$ R R RU ( ( ( sF /usr/lib/python2.7/site-packages/ansible/plugins/inventory/kubevirt.pyR š s
D( t
__future__R R R t typet
__metaclass__t
DOCUMENTATIONt EXAMPLESRB t ansible.plugins.inventory.k8sR R t K8sInventoryModuleR t openshift.dynamic.exceptionsR t ImportErrorR ( ( ( sF /usr/lib/python2.7/site-packages/ansible/plugins/inventory/kubevirt.pyt s r