??????????????
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 ddlmZmZmZeZdZdZddlZddl Z ddl Z ddl Z yddl m Z mZWn'ek rddl m Z mZnXddlmZddlmZddlmZmZdd lmZdd lmZdd lmZmZdd lmZdd l m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.de*fdYZ/edddddgZ0deefdYZ1de2fdYZ3de2fdYZ4d e2fd!YZ5dS("i(tabsolute_importtdivisiontprint_functions name: azure_rm plugin_type: inventory short_description: Azure Resource Manager inventory plugin extends_documentation_fragment: - azure description: - Query VM details from Azure Resource Manager - Requires a YAML configuration file whose name ends with 'azure_rm.(yml|yaml)' - By default, sets C(ansible_host) to the first public IP address found (preferring the primary NIC). If no public IPs are found, the first private IP (also preferring the primary NIC). The default may be overridden via C(hostvar_expressions); see examples. options: plugin: description: marks this as an instance of the 'azure_rm' plugin required: true choices: ['azure_rm'] include_vm_resource_groups: description: A list of resource group names to search for virtual machines. '\*' will include all resource groups in the subscription. default: ['*'] include_vmss_resource_groups: description: A list of resource group names to search for virtual machine scale sets (VMSSs). '\*' will include all resource groups in the subscription. default: [] fail_on_template_errors: description: When false, template failures during group and filter processing are silently ignored (eg, if a filter or group expression refers to an undefined host variable) choices: [True, False] default: True keyed_groups: description: Creates groups based on the value of a host variable. Requires a list of dictionaries, defining C(key) (the source dictionary-typed variable), C(prefix) (the prefix to use for the new group name), and optionally C(separator) (which defaults to C(_)) conditional_groups: description: A mapping of group names to Jinja2 expressions. When the mapped expression is true, the host is added to the named group. hostvar_expressions: description: A mapping of hostvar names to Jinja2 expressions. The value for each host is the result of the Jinja2 expression (which may refer to any of the host's existing variables at the time this inventory plugin runs). exclude_host_filters: description: Excludes hosts from the inventory with a list of Jinja2 conditional expressions. Each expression in the list is evaluated for each host; when the expression is true, the host is excluded from the inventory. default: [] batch_fetch: description: To improve performance, results are fetched using an unsupported batch API. Disabling C(batch_fetch) uses a much slower serial fetch, resulting in many more round-trips. Generally only useful for troubleshooting. default: true default_host_filters: description: A default set of filters that is applied in addition to the conditions in C(exclude_host_filters) to exclude powered-off and not-fully-provisioned hosts. Set this to a different value or empty list if you need to include hosts in these states. default: ['powerstate != "running"', 'provisioning_state != "succeeded"'] use_contrib_script_compatible_sanitization: description: - By default this plugin is using a general group name sanitization to create safe and usable group names for use in Ansible. This option allows you to override that, in efforts to allow migration from the old inventory script and matches the sanitization of groups when the script's ``replace_dash_in_groups`` option is set to ``False``. To replicate behavior of ``replace_dash_in_groups = True`` with constructed groups, you will need to replace hyphens with underscores via the regex_replace filter for those entries. - For this to work you should also turn off the TRANSFORM_INVALID_GROUP_CHARS setting, otherwise the core engine will just use the standard sanitization on top. - This is not the default as such names break certain functionality as not all characters are valid Python identifiers which group names end up being used as. type: bool default: False version_added: '2.8' plain_host_names: description: - By default this plugin will use globally unique host names. This option allows you to override that, and use the name that matches the old inventory script naming. - This is not the default, as these names are not truly unique, and can conflict with other hosts. The default behavior will add extra hashing to the end of the hostname to prevent such conflicts. type: bool default: False version_added: '2.8' sI # The following host variables are always available: # public_ipv4_addresses: all public IP addresses, with the primary IP config from the primary NIC first # public_dns_hostnames: all public DNS hostnames, with the primary IP config from the primary NIC first # private_ipv4_addresses: all private IP addressses, with the primary IP config from the primary NIC first # id: the VM's Azure resource ID, eg /subscriptions/00000000-0000-0000-1111-1111aaaabb/resourceGroups/my_rg/providers/Microsoft.Compute/virtualMachines/my_vm # location: the VM's Azure location, eg 'westus', 'eastus' # name: the VM's resource name, eg 'myvm' # os_profile: The VM OS properties, a dictionary, only system is currently available, eg 'os_profile.system not in ['linux']' # powerstate: the VM's current power state, eg: 'running', 'stopped', 'deallocated' # provisioning_state: the VM's current provisioning state, eg: 'succeeded' # tags: dictionary of the VM's defined tag values # resource_type: the VM's resource type, eg: 'Microsoft.Compute/virtualMachine', 'Microsoft.Compute/virtualMachineScaleSets/virtualMachines' # vmid: the VM's internal SMBIOS ID, eg: '36bca69d-c365-4584-8c06-a62f4a1dc5d2' # vmss: if the VM is a member of a scaleset (vmss), a dictionary including the id and name of the parent scaleset # availability_zone: availability zone in which VM is deployed, eg '1','2','3' # sample 'myazuresub.azure_rm.yaml' # required for all azure_rm inventory plugin configs plugin: azure_rm # forces this plugin to use a CLI auth session instead of the automatic auth source selection (eg, prevents the # presence of 'ANSIBLE_AZURE_RM_X' environment variables from overriding CLI auth) auth_source: cli # fetches VMs from an explicit list of resource groups instead of default all (- '*') include_vm_resource_groups: - myrg1 - myrg2 # fetches VMs from VMSSs in all resource groups (defaults to no VMSS fetch) include_vmss_resource_groups: - '*' # places a host in the named group if the associated condition evaluates to true conditional_groups: # since this will be true for every host, every host sourced from this inventory plugin config will be in the # group 'all_the_hosts' all_the_hosts: true # if the VM's "name" variable contains "dbserver", it will be placed in the 'db_hosts' group db_hosts: "'dbserver' in name" # adds variables to each host found by this inventory plugin, whose values are the result of the associated expression hostvar_expressions: my_host_var: # A statically-valued expression has to be both single and double-quoted, or use escaped quotes, since the outer # layer of quotes will be consumed by YAML. Without the second set of quotes, it interprets 'staticvalue' as a # variable instead of a string literal. some_statically_valued_var: "'staticvalue'" # overrides the default ansible_host value with a custom Jinja2 expression, in this case, the first DNS hostname, or # if none are found, the first public IP address. ansible_host: (public_dns_hostnames + public_ipv4_addresses) | first # places hosts in dynamically-created groups based on a variable value. keyed_groups: # places each host in a group named 'tag_(tag name)_(tag value)' for each tag on a VM. - prefix: tag key: tags # places each host in a group named 'azure_loc_(location name)', depending on the VM's location - prefix: azure_loc key: location # places host in a group named 'some_tag_X' using the value of the 'sometag' tag on a VM as X, and defaulting to the # value 'none' (eg, the group 'some_tag_none') if the 'sometag' tag is not defined for a VM. - prefix: some_tag key: tags.sometag | default('none') # excludes a host from the inventory when any of these expressions is true, can refer to any vars defined on the host exclude_host_filters: # excludes hosts in the eastus region - location in ['eastus'] # excludes hosts that are powered off - powerstate != 'running' N(tQueuetEmpty(t namedtuple(trelease(tBaseInventoryPlugint Constructable(t iteritems(t AzureRMAuth(tAnsibleParserErrort AnsibleError(tboolean(t to_nativetto_bytes(tchain(t ServiceClientt Serializert Deserializer(tAzureConfiguration(t ARMPolling(tparse_resource_idtAzureRMRestConfigurationcB`seZddZRS(cC`s|dkrtdn|dkr6tdn|sEd}ntt|j||jdjtj||_ ||_ dS(Ns)Parameter 'credentials' must not be None.s-Parameter 'subscription_id' must not be None.shttps://management.azure.comsansible-dynamic-inventory/{0}( tNonet ValueErrortsuperRt__init__tadd_user_agenttformatRt __version__t credentialstsubscription_id(tselfRR tbase_url((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRs    N(t__name__t __module__RR(((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRst UrlActionturlt api_versionthandlert handler_argstInventoryModulecB`seZdZdZdZedZdZddZ ddZ ddZ d Z d Z d Zd Zdd ZdZdZdZdZedZRS(tazure_rmcC`stt|jt|_t|_g|_d|_ d|_ d|_ idd6|_ t |_d|_t|_dS(Ns 2017-03-30s 2015-06-15sapplication/json; charset=utf-8s Content-Type(RR*RRt _serializerRt _deserializert_hostsRt_filterst_compute_api_versiont_network_api_versiont_default_header_parametersRt_request_queuet azure_authtFalset _batch_fetch(R!((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRs        cC`s5tt|j|r1tjd|r1tSntS(s :param loader: an ansible.parsing.dataloader.DataLoader object :param path: the path to the inventory config file :return the contents of the config file s.{0,}azure_rm\.y(a)?ml$(RR*t verify_filetretmatchtTrueR5(R!tpath((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyR7scC`stt|j||||j||jdrG|j|_n|jd|_|jd|_|jd|jd|_ y|j |j Wnt k rnXdS(Nt*use_contrib_script_compatible_sanitizationt batch_fetchtplain_host_namestexclude_host_filterstdefault_host_filters( RR*tparset_read_config_datat get_optiont,_legacy_script_compatible_group_sanitizationt_sanitize_group_nameR6t_legacy_hostnamesR/t_credential_setupt _get_hostst Exception(R!t inventorytloaderR;tcache((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRAs   cC`std|jdd|jdd|jdd|jdd|jdd|jdd|jdd|jdd |jd d |jd d |jd d |jd  }t||_t|jj|jj|jjjj |_ t |j j |j |_ dS( Nt auth_sourcetprofileR t client_idtsecretttenanttad_usertpasswordtcloud_environmenttcert_validation_modet api_profiletadfs_authority_url(tdictRCR R4Rtazure_credentialsR t_cloud_environmentt endpointstresource_managert _clientconfigRRt_client(R!t auth_options((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRGs"c C`s>|si}n|jjtd|d|d|d|dS(NR&R'R(R)(R3t put_nowaitR%(R!R&R'R(R)((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyt _enqueue_get$s t*cC`sf| s|dkrd}nd}|jd|jjd|}|jd|d|jd|jdS( NRbsK/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachiness_/subscriptions/{subscriptionId}/resourceGroups/{rg}/providers/Microsoft.Compute/virtualMachinestsubscriptionIdtrgR&R'R((RR]R RaR0t_on_vm_page_response(R!RdR&((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyt_enqueue_vm_list)s  cC`sf| s|dkrd}nd}|jd|jjd|}|jd|d|jd|jdS( NRbsS/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSetssg/subscriptions/{subscriptionId}/resourceGroups/{rg}/providers/Microsoft.Compute/virtualMachineScaleSetsRcRdR&R'R((RR]R RaR0t_on_vmss_page_response(R!RdR&((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyt_enqueue_vmss_list2s  c C`sx$|jdD]}|j|qWx$|jdD]}|j|q7W|jrd|jn |jt|jd}|jd}|jd}|jd}x |jD]}|j|}|j ||j rqn|j j ||j j |dtt|j d|j d dx3t|j D]"\} } |j j || | q@W|j||j |d ||j||j |d ||j||j |d |qWdS( Ntinclude_vm_resource_groupstinclude_vmss_resource_groupstfail_on_template_errorsthostvar_expressionstconditional_groupst keyed_groupst ansible_hosttpublic_ipv4_addressestprivate_ipv4_addresseststrict(RCRfRhR6t_process_queue_batcht_process_queue_serialR R.t _get_hostnamet _filter_hostthostvarsRJtadd_hostt set_variabletnextRRR t_set_composite_varst_add_host_to_composed_groupst_add_host_to_keyed_groups( R!tvm_rgtvmss_rgtconstructable_config_stricttconstructable_config_composetconstructable_config_groupst!constructable_config_keyed_groupsthtinventory_hostnametktv((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRH;s.   'cC`s||j_x|jD]}dj|}y t|jj|rJtSWqtk r}t|jdrt dj||t |qqqXqWt S(Ns4{{% if {0} %}} True {{% else %}} False {{% endif %}}Rks9Error evaluating filter condition '{0}' for host {1}: {2}( ttemplartavailable_variablesR/RR ttemplateR:RIRCR RR5(R!RRwt conditiont conditionalte((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRv^s $ cC`s|jS(N(tdefault_inventory_hostname(R!thost((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRunscC`scyKxDtrI|jj}|j|j|j}|j||jqWWntk r^nXdS(N( R:R3t get_nowaitt send_requestR&R'R(R)R(R!titemtresp((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRtrs  c C`s|jd}|r:|jd|d|jd|jnd|krx=|dD].}|jjt||d|d|jqQWndS(NtnextLinkR&R'R(tvaluetvmsst legacy_name(tgetRaR0ReR.tappendt AzureHostRF(R!tresponseRt next_linkR((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRe{s % c C`s|jd}|r:|jd|d|jd|jnxV|dD]J}dj|d}|jd|d|jd|jdtd |qEWdS( NRR&R'R(Rs{0}/virtualMachinestidR)R(RRaR0RgRReRX(R!RRRR&((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRgs %cC`sxtrg}d}t}yx|dkr|jj}ttj}i|jd6}|jj |j |}|j tddd|j d||||<|d7}q$WWnt k rnX|sPn|j |}d} d |krd } n!d |krd } n td xt|| D]p\} } | j d } | d} || }| d krtdj| |j n|j| d|jq1WqWdS(Niids api-versiont httpMethodtGETR&tnameit responsesRs:didn't find expected key responses/value in batch responsethttpStatusCodeis6a batched request failed with status code {0}, url {1}tcontent(R:RXR3Rtstrtuuidtuuid4R'R^RR&RRt _send_batchRR t enumerateRR(R)(R!tbatch_requeststbatch_item_indextbatch_response_handlersRRtquery_parameterstreqt batch_resptkey_nametidxtrt status_codet returned_nametresult((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRss>  %          c `sd}idd6}td|}jj|d}ittjd6}|jjjj ||}jj |||}t dd} | j d jd |d fd | j | jS( Ns/batchs 2015-11-01s api-versiontrequeststobjectsx-ms-client-request-idttimeoutitclienttinitial_responsetdeserialization_callbackc`sjd|S(NR(R-(R(R!(sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyts(RXR,tbodyRRRtupdateR2R^tposttsendRt initializetruntresource( R!tbatched_requestsR&Rtbody_objt body_contenttheadertrequestRtpoller((R!sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRs  cC`s`i|d6}|jj||}|jj||jdt}|j|j}tj|S(Ns api-versiontstream( R^RRR2R5traise_for_statusRtjsontloads(R!R&R'RRRR((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRs    cC`stjd}|jd|S(Ns[^A-Za-z0-9\_\-]t_(R8tcompiletsub(Rtregex((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRDsN(R#R$tNAMERR7R:RARGRRaRfRhRHRvRuRtReRgRsRRt staticmethodRD(((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyR*s$     #    )  RcB`sJeZejdZdedZedZ dZ edZ RS(s^PowerState/(?P.+)$c C`sI||_||_||_d|_d|_g|_|rL|d|_n9dj|dt j t |dj dd!|_i|_ |jddj|dd |jjd |j|d d d }xp|D]h}|jd ijdt|dk}|jd|dd |jjd |jdtd|qWdS(NtunknownRs{0}_{1}RiiR&s{0}/instanceViewR'R(t propertiestnetworkProfiletnetworkInterfacestprimaryiR)t is_primary(t_inventory_clientt _vm_modelt_vmssRt _instanceviewt _powerstatetnicsRRthashlibtsha1Rt hexdigestt _hostvarsRaR0t_on_instanceview_responseRtlenR1t_on_nic_responseRX(R!tvm_modeltinventory_clientRRtnic_refstnicR((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRs&      9    * c %C`s|jikr|jSd}d|jdkrrd|jddkrOd}nd|jddkrrd}qrnd}d|jkr|jd}ntd gd gd gd |jd d |jd d|jdd|d|jd|jddjd|jjdid|jjddd|jdddtd|d|jrrtd |jd d|jdnid|jdjdr|jdddndd|jdjdr|jdddnddt|jd jdj}xt |j d d!d"t D]}x t |j dd#d d$d"t D]}|djd%}|r~|d j |n|djd&ijd }|rK||d'<|j|}|jd|d(<|d j |jdjd)d|jdjd*ijd+} | r.|d j | q.qKqKW|j djd,|d-<|j d|d.<|j d |d/<|j djd0r|j dd0d nd|d1<|j djd0rt|d1d2nd|d3r| jd>jnd|d5nststatusesR(RRzRR(R!tvm_instanceview_model((R!sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRls cC`s2td|d|jd|}|jj|dS(Nt nic_modelRR(tAzureNicRRR(R!R5RR((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRqsN( R#R$R8RR/RR5RtpropertyRwRR(((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRs ` R6cB`seZedZdZRS(cC`s||_||_||_i|_|jdijdrxa|ddD]N}|djd}|rN|jjd|dd|jjd|jqNqNWndS(NRRRR&RR'R((R#RRR$RRaR1t_on_pip_response(R!R5RRR(R+((sF/usr/lib/python2.7/site-packages/ansible/plugins/inventory/azure_rm.pyRws    cC`st||j|ds>QK