Skip to content

Instantly share code, notes, and snippets.

View sky-joker's full-sized avatar
:shipit:

sky-joker sky-joker

:shipit:
View GitHub Profile
@sky-joker
sky-joker / main.yml
Last active August 9, 2023 21:54
This playbook is an example of cloning a new VM with vmwre.vmware_res
---
- name: This playbook is an example of cloning a new VM with vmwre.vmware_res
hosts: localhost
gather_facts: false
vars:
vcenter_hostname: change me to vcenter host or ip
vcenter_username: administrator@vsphere.local
vcenter_password: change me to user password
folder: F0
template_vm: test_vm1
@sky-joker
sky-joker / get-guestos-processes.py
Last active March 16, 2022 20:53
pyvmomiでGuest OSのプロセス一覧を取得する
#!/usr/bin/env python3
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim, vmodl
from getpass import getpass
import ssl
import atexit
import argparse
import sys
def options():
@sky-joker
sky-joker / ansible-tower-api-tool.py
Last active October 24, 2021 21:56
Ansible TowerのAPI経由からテンプレートに変数を渡して実行してみた ref: https://qiita.com/sky_jokerxx/items/db48a57ecf91fad0ef39
#!/usr/bin/env python3
from getpass import getpass
import argparse
import sys
import json
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def options():
@sky-joker
sky-joker / clone_vm.yml
Last active October 24, 2021 21:56
ESXi single clone vm sample playbook(ref: http://ur2.link/vIFg)
---
- name: ESXi single clone vm demo
hosts: all
gather_facts: no
vars:
vm_password: !vault |
$ANSIBLE_VAULT;1.1;AES256
(snip)
tasks:
- name: Get datastore infomation
#!/usr/bin/python3
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim
import ssl
import atexit
if __name__ == '__main__':
# 接続情報
host = 'IP or FQDN'
username = 'administrator@vsphere.local'
#!/usr/bin/python3
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim
import ssl
import atexit
if __name__ == '__main__':
# 接続情報
host = 'vCenter IP or Host Name'
username = 'administrator@vsphere.local'
@sky-joker
sky-joker / get_ansible_tower_authtoken.py
Created February 26, 2018 11:53
Ansible Towerのauth token取得方法
#!/usr/bin/env python3
import json
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
if __name__ == '__main__':
url = "https://ansible tower ip or fqdn/api/v2/authtoken/"
headers = { "Content-Type": "application/json" }
data = {
@sky-joker
sky-joker / get_ansible_tower_hostlist.py
Created February 26, 2018 12:38
Ansible Towerでホストリストを取得する方法
#!/usr/bin/env python3
import json
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
if __name__ == '__main__':
url = "https://ansible tower ip or fqdn/api/v2/authtoken/"
headers = { "Content-Type": "application/json" }
data = {
@sky-joker
sky-joker / git_operation.yml
Created May 6, 2018 09:09
AWXのテンプレートワークフローで検証したPlaybook
---
- name: git test
hosts: localhost
gather_facts: no
vars:
# git config
#repo: "https://{{ git_user }}:{{ git_pass}}@gitlab.com/username/repo.git"
#remote_repo_name: origin
#git_user: username
#git_pass: password
@sky-joker
sky-joker / vmware_get_console_url.py
Last active October 24, 2021 18:17
VMwareのHTML Console SDKで使用するWebSocketのURLを生成するツール
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim
from getpass import getpass
import ssl
import atexit
import argparse
import sys