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 / file0.txt
Last active August 29, 2018 15:26
pyvmomiでvCenterのWeb コンソールに接続するツールを作ってみた ref: https://qiita.com/sky_jokerxx/items/15aaac168e5140edcc45
#!/usr/bin/env python3
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim, vmodl
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from binascii import hexlify
from getpass import getpass
import ssl
import atexit
@sky-joker
sky-joker / inventory_var.yml
Last active August 26, 2018 15:50
Ansible Tower(AWX)のインベントリ変数でvaultを使う方法 ref: https://goo.gl/gHMybC
message:
__ansible_vault: >-
$ANSIBLE_VAULT;1.1;AES256
36623065363836653763626531636261613834653839353832663236316134646665356539643362
3330353263653837353832316139663963373037636261650a313531613564643337366661313065
30313332383563303866333833613332643631353463346166333565306631316364363039663636
@sky-joker
sky-joker / test_zabbix_user_group.yml
Created July 1, 2018 06:29
AnsibleでZabbixのユーザーグループを追加するモジュール(途中破棄版)
---
- name: test_zabbix_user_gorup module test
hosts: localhost
gather_facts: no
tasks:
- zabbix_user_group:
server_url: http://192.168.0.220/zabbix
login_user: admin
login_password: zabbix
validate_certs: no
@sky-joker
sky-joker / file4.txt
Last active June 17, 2018 05:14
Ansibleで自作Windowsモジュールを作ってみる ref: https://qiita.com/sky_jokerxx/items/03e83befb75bb9de685e
[root@localhost ~]# ansible-playbook main.yml -i inventory --module-path module/
PLAY [salf-made windows module test] ****************************************************************************************************
TASK [win_file_check] *******************************************************************************************************************
ok: [192.168.0.135]
PLAY RECAP ******************************************************************************************************************************
192.168.0.135 : ok=1 changed=0 unreachable=0 failed=0
@sky-joker
sky-joker / vm_inventory_example_vars.yml
Last active June 3, 2018 08:00
AWX(Ansible Tower)のインベントリーソース VMware vCenter で取得した仮想インスタンス変数
resourcepool:
_moId: resgroup-22
name: Resources
customvalue: []
permission: []
storage:
dynamictype: null
timestamp: {}
dynamicproperty: []
perdatastoreusage: []
@sky-joker
sky-joker / pyvmomi_template.py
Created June 2, 2018 13:43
pyvmomi connect template
#!/usr/bin/env python3
from pyVim.connect import SmartConnect, Disconnect
from pyVmomi import vim, vmodl
import ssl
import atexit
host = ""
username = ""
password = ""
mob = vim.VirtualMachine
@sky-joker
sky-joker / file0.txt
Last active May 27, 2018 05:29
VMware VIX APIをPythonで触ってみる ref: https://qiita.com/sky_jokerxx/items/8abad5f95cf8f12599c8
[root@localhost ~]# sh VMware-VIX-1.15.0-2985596.x86_64.bundle
Extracting VMware Installer...done.
You must accept the VMware VIX API End User License Agreement to
continue. Press Enter to proceed. Enterを押す
(snip)
and enforceable to the fullest extent permitted by law.
Do you agree? [yes/no]: yes
@sky-joker
sky-joker / file1.txt
Created May 13, 2018 10:20
AnsibleのJunosモジュールの接続実装について確認してみたメモ ref: https://qiita.com/sky_jokerxx/items/72e8e8b05a18ef04579c
[root@localhost dev]# grep 'def ' ansible-devel/lib/ansible/plugins/cliconf/junos.py | sed -e "s/^ *def //g" -e "s/:$//g"
get_text(self, ele, tag)
get_device_info(self)
get_config(self, source='running', format='text')
edit_config(self, command)
get(self, command, prompt=None, answer=None, sendonly=False)
commit(self, *args, **kwargs)
discard_changes(self)
get_capabilities(self)
compare_configuration(self, rollback_id=None)
@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 / gitlab_project.py
Created May 3, 2018 12:55
GitLabのprojectを作成、削除するAnsibleモジュール(練習用に作成)
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, sky_joker
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible.module_utils.basic import AnsibleModule
import json
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning