??????????????
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 d d l m
Z
d d l m Z y$ d d l m Z d d l m Z Wn e k
r³ e
d
n Xd e f d YZ d S(
i ( t absolute_importt divisiont print_functions
name: linode
plugin_type: inventory
author:
- Luke Murphy (@lwm)
short_description: Ansible dynamic inventory plugin for Linode.
version_added: "2.8"
requirements:
- python >= 2.7
- linode_api4 >= 2.0.0
description:
- Reads inventories from the Linode API v4.
- Uses a YAML configuration file that ends with linode.(yml|yaml).
- Linode labels are used by default as the hostnames.
- The inventory groups are built from groups and not tags.
options:
plugin:
description: marks this as an instance of the 'linode' plugin
required: true
choices: ['linode']
access_token:
description: The Linode account personal access token.
required: true
env:
- name: LINODE_ACCESS_TOKEN
regions:
description: Populate inventory with instances in this region.
default: []
type: list
required: false
types:
description: Populate inventory with instances with this type.
default: []
type: list
required: false
sή
# Minimal example. `LINODE_ACCESS_TOKEN` is exposed in environment.
plugin: linode
# Example with regions, types, groups and access token
plugin: linode
access_token: foobar
regions:
- eu-west
types:
- g5-standard-2
N( t AnsibleErrort AnsibleParserError( t string_types( t BaseInventoryPlugin( t LinodeClient( t ApiErrors9 the Linode dynamic inventory plugin requires linode_api4.t InventoryModulec B` sk e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z
d Z e d
Z
RS( t linodec C` sq | j d } | d k rC y t j d } WqC t k
r? qC Xn | d k r^ t d n t | | _ d S( s Build the Linode client.t access_tokent LINODE_ACCESS_TOKENsO Could not retrieve Linode access token from plugin configuration or environmentN( t
get_optiont Nonet ost environt KeyErrorR R t client( t selfR ( ( sD /usr/lib/python2.7/site-packages/ansible/plugins/inventory/linode.pyt
_build_clientK s
c C` sC y | j j j | _ Wn# t k
r> } t d | n Xd S( s: Retrieve Linode instance information from cloud inventory.s Linode client raised: %sN( R R
t instancest LinodeApiErrorR ( R t exception( ( sD /usr/lib/python2.7/site-packages/ansible/plugins/inventory/linode.pyt _get_instances_inventory^ s c C` sY t t d g | j D] } | j ^ q | _ x! | j D] } | j j | q; Wd S( s4 Add Linode instance groups to the dynamic inventory.N( t sett filterR R t groupt
linode_groupst inventoryt add_group( R t instancet linode_group( ( sD /usr/lib/python2.7/site-packages/ansible/plugins/inventory/linode.pyt _add_groupse s %c C` sx | r: g | j D] } | j j | k r | ^ q | _ n | rt g | j D] } | j j | k rJ | ^ qJ | _ n d S( s1 Filter instances by user specified configuration.N( R t regiont idt type( R t regionst typesR ( ( sD /usr/lib/python2.7/site-packages/ansible/plugins/inventory/linode.pyt _filter_by_configr s $c C` s4 x- | j D]" } | j j | j d | j q
Wd S( s5 Add instance names to their dynamic inventory groups.R N( R R t add_hostt labelR ( R R ( ( sD /usr/lib/python2.7/site-packages/ansible/plugins/inventory/linode.pyt _add_instances_to_groups s c C` sO xH | j D]= } | j } x+ | D]# } | j j | j | | | q Wq
Wd S( s4 Add hostvars for instances in the dynamic inventory.N( R t _raw_jsonR t set_variableR) ( R R t hostvarst hostvar_key( ( sD /usr/lib/python2.7/site-packages/ansible/plugins/inventory/linode.pyt _add_hostvars_for_instances
s
c C` sn t | t r' | t k r' | g } n | d k r? | } n t | | sj t d | | | f n | S( s9 Validate user specified configuration data against types.s The option %s (%s) must be a %sN( t
isinstanceR t listR R ( R t namet desired_typet option_value( ( sD /usr/lib/python2.7/site-packages/ansible/plugins/inventory/linode.pyt _validate_option s c C` s¬ i i t d 6| j d g d 6d 6i t d 6| j d g d 6d 6} x; | D]3 } | j | | | d | | d | | d