Skip to content

Instantly share code, notes, and snippets.

View jctanner's full-sized avatar

James Tanner jctanner

View GitHub Profile
#!/bin/bash
ANSIBLE_ASK_PASS=False \
ANSIBLE_HOST_KEY_CHECKING=False \
PROJECT_UPDATE_ID=23 \
CELERY_LOG_REDIRECT_LEVEL=WARNING \
USER=awx \
ANSIBLE_BECOME_ASK_PASS=False \
ANSIBLE_VENV_PATH=/var/lib/awx/venv/ansible \
ANSIBLE_CALLBACK_PLUGINS="/var/lib/awx/venv/awx/lib/python2.7/site-packages/awx/plugins/callback" \
#!/usr/bin/env python
import argparse
import glob
import os
import shutil
import subprocess
import sys
import tempfile
@jctanner
jctanner / esxi_clone.py
Created June 27, 2018 18:22
ansible esxi_clone module
#!/usr/bin/python
# https://kb.vmware.com/s/article/1541 -- UUIDs
# https://kb.vmware.com/s/article/1000936
# http://www.vmwareblog.org/clone-vms-vmware-vcenter-unavailable/
# https://tylermade.net/2017/01/31/cloning-vms-in-vmware-vsphere-esxi-without-vcenter-the-right-way/
# https://nchrissos.wordpress.com/2014/03/05/clone-a-vmwares-vm-without-vcenter-in-esxi-5-x-by-commands-the-official-way/
import os
import paramiko
12 - name: Download plugin
13 get_url:
14 url: "{{ item.url }}"
15 dest: "{{ redmine_home }}/plugins/"
18 when: plugin_directory_stat.stat.exists == False
19 register: plugin_download
20 become: true
21 become_user: redmine
- hosts: el7host
connection: local
gather_facts: False
tasks:
- name: set a non-cacheable fact
set_fact:
foo: 1
- name: set a cacheable fact
set_fact:
c_foo: 3
@jctanner
jctanner / example.log
Last active February 12, 2018 20:07
findvar filter plugin
PLAYBOOK: site.yml *******************************************************************************
1 plays in site.yml
PLAY [all] ***************************************************************************************
META: ran handlers
TASK [debug] *************************************************************************************
task path: /home/jtanner/workspace/issues/AP-HOSTVAR_LOOKUP/site.yml:5
ok: [el6host] => {
"failed": false,
@jctanner
jctanner / README.md
Last active February 8, 2018 21:25
openshift lab
  1. sudo ./make_openshift_cluster.sh
  2. sed -i.bak 's/^ose.*//g' ~/.ssh/known_hosts
  3. ./create_admin_inventory.sh
  4. ansible-playbook -v -i inventory.admin prepare_vms.yml
  5. ./run_os_ansible.sh
$ cat test_sprocket.py
#!/usr/bin/python
# Example reference test ...
# https://github.com/ansible/ansible/blob/devel/test/units/modules/net_tools/test_nmcli.py
# Pytest fixtures ...
# http://pythontesting.net/framework/pytest/pytest-fixtures-nuts-bolts/
import pytest
diff --git a/test/runner/lib/target.py b/test/runner/lib/target.py
index 3038eda..760303f 100644
--- a/test/runner/lib/target.py
+++ b/test/runner/lib/target.py
@@ -291,7 +291,7 @@ def walk_test_targets(path=None, module_path=None, extensions=None,
:type extra_dirs: tuple[str] | None
:rtype: collections.Iterable[TestTarget]
"""
- for root, _, file_names in os.walk(path or '.', topdown=False):
+ for root, _, file_names in os.walk(path or '.', topdown=False, followlinks=True):
@jctanner
jctanner / reproducer.sh
Created January 3, 2018 19:54
openshfit ansible memory reproducer
#!/bin/bash
mkdir -p strategy_plugins
mkdir -p roles
# roles are in a nested dir from a separate tools repo
if [ ! -d openshift-tools ]; then
git clone https://github.com/openshift/openshift-tools
fi
if [ ! -s roles/tools_roles ]; then