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 / 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 / vmware_vm_uuid_facts.py
Created March 13, 2018 14:42
Ansible module for getting vm uuid
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, sky_jokerxx
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
try:
from pyVmomi import vim, vmodl
HAS_PYVMOMI = True
except ImportError:
@sky-joker
sky-joker / vmware_folder.py
Created March 13, 2018 11:41
Ansible module for creating vmware folder
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, sky_jokerxx
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
try:
from pyVmomi import vim, vmodl
HAS_PYVMOMI = True
except ImportError:
@sky-joker
sky-joker / add_virtualmachine_name.patch
Last active March 11, 2018 10:39
Patch to add virtualmachine_name to vcenter_gather_moids
--- before/vcenter_gather_moids.py 2018-03-11 19:39:17.424120400 +0900
+++ after/vcenter_gather_moids.py 2018-03-11 19:39:11.644014260 +0900
@@ -30,7 +30,8 @@
'dvs_name': [vim.dvs.VmwareDistributedVirtualSwitch],
'datastore_name': [vim.Datastore],
'resourcepool_name': [vim.ResourcePool],
- 'portgroup_name': [vim.dvs.DistributedVirtualPortgroup, vim.Network]}
+ 'portgroup_name': [vim.dvs.DistributedVirtualPortgroup, vim.Network],
+ 'virtualmachine_name': [vim.VirtualMachine]}
@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 / 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 / example.py
Created January 29, 2018 14:42
goで構造体内に定義した配列をネストして値を取得するやり方 ref: https://qiita.com/sky_jokerxx/items/5c80ac097d74273dd91f
#!/usr/bin/env python3
array = [1, 2, 3]
array2 = [4, 5, 6]
array3 = [7,8,9]
array2.append(array3)
array.append(array2)
print(array)
def rec(a):
@sky-joker
sky-joker / pcitemChildrenAppend.go
Created January 28, 2018 16:27
readlineのPcItemのChildrenに追加する方法
package main
import (
"fmt"
"github.com/chzyer/readline"
)
//type array []readline.PrefixCompleterInterface
//type array []readline.PrefixCompleter
@sky-joker
sky-joker / file1.txt
Last active March 24, 2018 05:14
goでsshクライアントの実装メモ ref: https://qiita.com/sky_jokerxx/items/fd79c71143a72cb4efcd
[root@localhost hoge5]# go run main.go --host 192.168.0.233
Password:
Last login: Mon Jan 22 20:37:54 2018 from 192.168.0.231
[root@localhost ~]# ls
anaconda-ks.cfg
[root@localhost ~]# exit
ログアウト
@sky-joker
sky-joker / file1.txt
Last active January 22, 2018 07:30
goでオリジナルのコンソールを作る ref: https://qiita.com/sky_jokerxx/items/ebcbdef638d08f9dc3f2
[root@localhost ~]# go build orishell.go
[root@localhost ~]# mv orishell /usr/local/bin