Skip to content

Instantly share code, notes, and snippets.

View Akasurde's full-sized avatar
🌏
To the infinity and beyond

Abhijeet Kasurde Akasurde

🌏
To the infinity and beyond
View GitHub Profile
@Akasurde
Akasurde / main.yml
Created April 29, 2020 12:21
Reuse tag manager
---
- hosts: localhost
tasks:
- include_tasks: vmware_tag_manager.yml
vars:
vcenter_hostname: 'vc1.test.com'
vcenter_password: 'password'
vcenter_username: '[email protected]'
object_name: 'Cluster1'
object_type: ClusterComputeResource
@Akasurde
Akasurde / ansible_migrate.py
Created April 2, 2020 10:48
Python script to help with migrating issues and PRs from ansible/ansible to a target collection. Original Script - https://gist.github.com/jborean93/1a060f4c7c17bbecd94cc1597e580b54
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# PYTHON_ARGCOMPLETE_OK
# Copyright: (c) 2020, Jordan Borean (@jborean93) <[email protected]>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
"""
Script that can be used to copy issues and PRs from the Ansible GitHub repo to it's target collection repo. Current
limitations are;
for i in `cat user.txt`
do
user=`echo $i | awk -F ":" '{print $1}'`
password=`echo $i | awk -F ":" '{print $2}'`
echo "Changing password for ${user}"
echo "${password}" | passwd --stdin ${user}
if [ $? -eq 0 ]; then
echo "Password changed for ${user}"
else
echo "Failed to change password for ${user}"
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Abhijeet Kasurde <[email protected]>
# Copyright: (c) 2020, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
@Akasurde
Akasurde / vcenter_connect.py
Created July 22, 2019 07:06
Vmware test code
from pyVim.connect import SmartConnect, Disconnect
import ssl
import atexit
from pyVmomi import vim, vmodl
def connect(hostname, username, password):
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.verify_mode = ssl.CERT_NONE
si = SmartConnect(host=hostname,
@Akasurde
Akasurde / gist:5e28e6ecb9ae1262176cdc78a9b91bd3
Created July 31, 2018 10:19
Instructions for the DevConf Ansible Workshop
1. Download and Install VirtualBox - https://www.virtualbox.org/wiki/Downloads (Please check respective OS instructions)
2. Download and Install Vagrant - http://www.vagrantup.com/downloads.html (Please check OS specific instructions)
3. Create a new directory
4. From the command line, run the following commands: (This will download Fedora 28 image and save as box)
$ vagrant init fedora/28-cloud-base
$ vagrant up
$ vagrant ssh
$ exit
@Akasurde
Akasurde / console.log
Created July 9, 2018 11:20
Multiple tasks
$ cat main.yml
---
- hosts: localhost
gather_facts: no
tasks:
- include: "snapshot.yml snap={{ servername }}"
with_items:
- vm_name: server1
snap_name: snap_1
@Akasurde
Akasurde / gist:51a951a0b7ab677626a9d079029d9f31
Created June 17, 2018 08:07
Python Pune June Meetup 2018
Revisiting Python3
++++++++++++++++++
Everyone just join this link for etherpad, it will be easy for you to copy links and share code -
https://review.rdoproject.org/etherpad/p/pythonjune-101
Just add your name when you are typing anything here -
[abhijeet] https://gitlab.com/akasurde/python3_101 - Final project code is here
If you get SSL verify error
# python get-pip.py
Collecting pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None,
@Akasurde
Akasurde / console.log
Created June 7, 2018 11:40
Ldap_attr
[root@qeos-39 ~]# ldapsearch -x -D "cn=Directory Manager" -h localhost -p 38901 -b "uid=testuser,ou=People,dc=example,dc=com" -w password
# extended LDIF
#
# LDAPv3
# base <uid=testuser,ou=People,dc=example,dc=com> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#
# testuser, People, example.com