Skip to content

Instantly share code, notes, and snippets.

View roberto-mardeni's full-sized avatar

Roberto Mardeni roberto-mardeni

View GitHub Profile
@roberto-mardeni
roberto-mardeni / Encrypt-ConfigurationSections.ps1
Created April 1, 2016 14:47
.Net Configuration Sections Encryption
function Encrypt-ConfigurationSection {
param(
[Parameter(Mandatory=$true)]
[ValidateScript({ Test-Path $_ -PathType ‘Leaf’ })]
[String]$ConfigurationFilePath,
[Parameter(Mandatory=$true)]
[String]$SectionNames,
[Parameter(Mandatory=$true)]
[ValidateSet(“RsaProtectedConfigurationProvider”,”DataProtectionConfigurationProvider”)]
[String]$DataProtectionProvider
[rmardeni@chef-server-01 ~]$ sudo chef-backend-ctl status elasticsearch
Role: Follower, leader is '10.0.0.4'
Local Status: running (pid 677)
Logging: running (pid 673)
Time up: 0d 0h 7m 47s
Cluster Status: green
Active Shards: 100.0%
** Nodes **
Healthy: 10.0.0.4
10.0.0.5
INFO: Using configuration from /Users/rmardeni/.chef/knife.rb
DEBUG: Chef::HTTP calling Chef::HTTP::JSONInput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_request
DEBUG: Signing the request as rmardeni
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_request
DEBUG: Initiating GET to https://ccl-chef.eastus.cloudapp.azure.com/clients
INFO: Using configuration from /Users/rmardeni/.chef/knife.rb
DEBUG: Chef::HTTP calling Chef::HTTP::JSONInput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::JSONOutput#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::CookieManager#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Decompressor#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::Authenticator#handle_request
DEBUG: Signing the request as rmardeni
DEBUG: Chef::HTTP calling Chef::HTTP::RemoteRequestID#handle_request
DEBUG: Chef::HTTP calling Chef::HTTP::ValidateContentLength#handle_request
DEBUG: Initiating GET to https://ccl-chef.eastus.cloudapp.azure.com/organizations/Carnival/clients
* ruby_block[bootstrap-chef-server-data] action run
================================================================================
Error executing action `run` on resource 'ruby_block[bootstrap-chef-server-data]'
================================================================================
PG::UniqueViolation
-------------------
ERROR: duplicate key value violates unique constraint "users_username_key"
DETAIL: Key (username)=(pivotal) already exists.
* runit_service[nginx] action restart
================================================================================
Error executing action `restart` on resource 'runit_service[nginx]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /opt/opscode/embedded/bin/sv restart /opt/opscode/service/nginx ----
[2016-08-05T14:59:16.469241 #8171] INFO -- : ------- Attempting to configure build-rhel-01.eastus2.cloudapp.azure.com as rmardeni
W, [2016-08-05T14:59:16.469488 #8171] WARN -- : [SSH] PTY requested: stderr will be merged into stdout
D, [2016-08-05T14:59:16.476631 #8171] DEBUG -- : [SSH] [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_only=>nil, :keys=>nil, :password=>"<hidden>", :forward_agent=>nil}> (/usr/bin/sw_vers)
D, [2016-08-05T14:59:16.476745 #8171] DEBUG -- : [SSH] opening connection to [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>false, :compression_level=>0, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :auth_methods=>["none", "password", "keyboard-interactive"], :keys_
@roberto-mardeni
roberto-mardeni / gist:61a72b27711465f16e559e756bcabe7d
Created September 19, 2016 15:10
Chef - Delivery Local Unit failure
Robertos-MacBook-Pro:carnival_rhel_base rmardeni$ export RUST_BACKTRACE=1
Robertos-MacBook-Pro:carnival_rhel_base rmardeni$ delivery local unit
Chef Delivery
Running Unit Phase
thread '<main>' panicked at 'Unexpected error: Failed to execute process: No such file or directory (os error 2)', src/delivery/command/local.rs:53
stack backtrace:
1: 0x103110e68 - std::sys::backtrace::tracing::imp::write::h4c73fcd3363076f5
2: 0x103117eb5 - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0422dbb3077e6747
3: 0x103117aee - std::panicking::default_hook::haac48fa641db8fa2
4: 0x1030fed56 - std::sys_common::unwind::begin_unwind_inner::h39d40f52add53ef7
# Configure Firewall
ufw allow from any to any port 1433 proto tcp
ufw allow from any to any port 135 proto tcp
ufw allow from any to any port 51000 proto tcp
# Configure Port Routing
ip=$(curl ifconfig.me)
iptables -t nat -A PREROUTING -d $ip -p tcp --dport 135 -m addrtype --dst-type LOCAL -j DNAT --to-destination $ip:13500 -m comment --comment RpcEndPointMapper
iptables -t nat -A OUTPUT -d $ip -p tcp --dport 135 -m addrtype --dst-type LOCAL -j DNAT --to-destination $ip:13500 -m comment --comment RpcEndPointMapper
iptables-save > /etc/iptables.conf
@roberto-mardeni
roberto-mardeni / selenium.aci.yaml
Created July 7, 2020 14:22
Selenium on Azure Container Instances Sample
apiVersion: 2018-10-01
location: eastus
name: selenium
properties:
containers:
- name: selenium-hub
properties:
environmentVariables:
- name: 'JAVA_TOOL_OPTIONS'
value: '-Xmx800m'