Last active
September 21, 2022 06:02
-
-
Save DevoKun/c72cd08230836c089eb6f1c735ecb040 to your computer and use it in GitHub Desktop.
Revisions
-
DevoKun revised this gist
Apr 18, 2019 . No changes.There are no files selected for viewing
-
DevoKun created this gist
Apr 18, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ --- - hosts: localhost pre_tasks: - name: "apt install curl" apt: name: curl state: latest when: ansible_os_family == "Debian" - name: "yum install curl" yum: name: curl state: present when: (ansible_os_family == "RedHat") - name: "get metadata" shell: "curl -H Metadata:true http://169.254.169.254/metadata/instance?api-version=2017-04-02" register: azure_metadata - name: "set azure_metadata" set_fact: azure_metadata: "{{ azure_metadata.stdout | from_json }}" tasks: - debug: msg: - "####################################" - "## eastus: {{ azure_metadata.compute.location }}" - "####################################"