Skip to content

Instantly share code, notes, and snippets.

View glennswest's full-sized avatar
🏠
Working from home

Glenn West glennswest

🏠
Working from home
View GitHub Profile
@glennswest
glennswest / client-setup.yml
Created August 26, 2017 13:11
Create Keycloak Client Registration Using Ansible URL Module
---
- hosts: localhost
vars:
description: "auth users"
create_data:
clientId: "openshift"
name: "OpenShift"
description: "OpenShift Console Authentication"
enabled: true
protocol: "openid-connect"
@glennswest
glennswest / update-cns.yaml
Created November 28, 2017 08:43
Update RedHat Container Native Storage
- hosts: cns01
vars:
description: "get updated templates for cns"
tasks:
- name: add cns channel
shell: subscription-manager repos --enable=rh-gluster-3-for-rhel-7-server-rpms
- name: install latest cns-deploy package
yum: name="cns-deploy" state=latest
- name: install latest kerketi packages
yum: name="heketi-client" state=latest
$INTERFACE_ALIAS="Ethernet 3"
Stop-Service ovs-vswitchd -force; Get-VMSwitch -SwitchType External | Disable-VMSwitchExtension "Cloudbase Open vSwitch Extension"
Get-VMSwitch -SwitchType External | Set-VMSwitch -AllowManagementOS $false
# Ignore the error from the first command
Get-VMSwitch -SwitchType External | Set-VMSwitch -AllowManagementOS $false
ovs-vsctl --no-wait --may-exist add-br br-ex
ovs-vsctl --no-wait add-port br-ex '$INTERFACE_ALIAS'
Get-VMSwitch -SwitchType External | Enable-VMSwitchExtension "Cloudbase Open vSwitch Extension"; sleep 2; Restart-Service ovs-vswitchd
# Clone the MAC Address of $INTERFACE_ALIAS on br-ex
$MAC_ADDRESS=$(Get-NetAdapter "$INTERFACE_ALIAS").MacAddress
@glennswest
glennswest / pipeprob
Created June 21, 2018 14:26
Ansible Windows Pipe Issue
The Ansible Script
- hosts: winnode01
gather_facts: no
tasks:
- name: grant the ansible user the SeTcbPrivilege right
win_user_right:
name: SeTcbPrivilege
users: '{{ansible_user}}'
action: add
- name: Set up the GUID for openvswitch
@glennswest
glennswest / scheduledansiblewindows
Created June 21, 2018 19:35
For privileged command for named pipes, you either have to use credssp transport or a schedule task
- hosts: winnode01
gather_facts: no
tasks:
- name: create a schedule task
win_scheduled_task:
name: ovnsetguid
description: Set OVN System Guid
executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
arguments: -ExecutionPolicy Unrestricted -NonInteractive ovs-vsctl set Open_vSwitch . external_ids:system-id=1919
frequency: once
TASK [openshift_version : Get available RPM version] ***************************
fatal: [openshift.ncc9.com]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to openshift.ncc9.com closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_hjvg6s/ansible_module_repoquery.py\", line 642, in <module>\r\n main()\r\n File \"/tmp/ansible_hjvg6s/ansible_module_repoquery.py\", line 632, in main\r\n rval = Repoquery.run_ansible(module.params, module.check_mode)\r\n File \"/tmp/ansible_hjvg6s/ansible_module_repoquery.py\", line 588, in run_ansible\r\n results = repoquery.repoquery()\r\n File \"/tmp/ansible_hjvg6s/ansible_module_repoquery.py\", line 547, in repoquery\r\n rval = self._repoquery_cmd(repoquery_cmd, True, 'raw')\r\n File \"/tmp/ansible_hjvg6s/ansible_module_repoquery.py\", line 385, in _repoquery_cmd\r\n returncode, stdout, stderr = _run(cmds)\r\n File \"/tmp/ansible_hjvg6s/ansible_module_repoquery.py\", line 356, in _run
@glennswest
glennswest / dhcpd.conf
Created July 16, 2018 20:03
Example dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
subnet 147.75.39.72 netmask 255.255.255.248 {
option routers 147.75.39.73;
option subnet-mask 255.255.255.248;
option domain-name "ncc9.com";
yum-config-manager --save --setopt=aos-3.10.skip_if_unavailable=true
failure: repodata/repomd.xml from aos-3.10: [Errno 256] No more mirrors to try.
http://download-node-02.eng.bos.redhat.com/rcm-guest/puddles/RHAOS/AtomicOpenShift/3.10/latest/x86_64/os/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: download-node-02.eng.bos.redhat.com; Unknown error"
Loaded plugins: product-id, search-disabled-repos, subscription-manager
http://download-node-02.eng.bos.redhat.com/rcm-guest/puddles/RHAOS/AtomicOpenShift/3.10/latest/x86_64/os/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: download-node-02.eng.bos.redhat.com; Unknown error"
Trying other mirror.
$a = Test-Path "C:\k\network_setup.lock"
IF ($a -eq "True") {Write-Host "Network Already Installed";exit}
Write-Host "Installing Network"
date > c:\k\network_setup.lock
$ErrorActionPreference = "SilentlyContinue"
$roughname = Get-NetAdapter | where adminstatus -eq "up" | Format-List -Property "Name" | Out
-String
$INTERFACE_ALIAS= $roughname.Substring(11)
Stop-Service ovs-vswitchd -force; Get-VMSwitch -SwitchType External | Disable-VMSwitchExtension "Cloudbase Open vSwitch Extension"
$a = Test-Path "C:\k\docker_create.lock"
IF ($a -eq "True") {Write-Host "Docker Network Already Created";exit}
Write-Host "Creating Docker Network"
date > c:\k\docker_create.lock
$roughname = Get-NetAdapter | where adminstatus -eq "up" | Format-List -Property "Name" | Out
-String
$NetAdapterName = $roughname.Substring(11)
# multinode
#docker network create -d transparent --gateway 10.128.2.1 --subnet 10.128.2.0/24 -o com.docker.network.windowsshim.interface="Ethernet0" external
# Single node