Skip to content

Instantly share code, notes, and snippets.

View ildarmf's full-sized avatar
🌴

Ildar ildarmf

🌴
  • Frankfurt
View GitHub Profile
@ildarmf
ildarmf / openssl
Last active September 5, 2017 09:42
openssl
#generate csr
openssl genrsa -out sky.com.key 2048
openssl req -new -key sky.com.key -out skybonds.com.csr
#dhparam for nginx
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
#!/bin/bash
LAST_KERNEL=$(rpm -q --last kernel | perl -pe 's/^kernel-(\S+).*/$1/' | head -1)
CURRENT_KERNEL=$(uname -r)
test $LAST_KERNEL = $CURRENT_KERNEL || echo need_reboot_system
$ git push origin --delete <branch_name>
$ git branch -d <branch_name>
sudo sh -c "openssl passwd -apr1 >> 1"
sed '1,4 d' file #remove lines 1-4 in file
@ildarmf
ildarmf / docker
Last active January 10, 2018 08:25
#docker logs
journalctl -u docker.service
docker rm -fv $(docker ps -a | grep Created | awk '{print $1}')
#docker rm all volumes
docker volume rm $(docker volume ls | awk '{print $2}' | grep -v VOLUME)
#docker remove all none images
docker rmi -f $(docker images | grep "<none>" | awk '{ print $3}')

Running the a playbook to create an EC2 host, I find that there is a race condition for Ansible to be able to connect to the host.

Both wait_for and shell: echo host_is_up (with retry / do..until loop) tasks are not enough to avoid hitting the race condition where Ansible fails to SSH.

Running the play shows that the "Wait for SSH" task completes successfully, and the initial connect for the "Wait up to 10mins for potential cloud-init sshd race condition" task fails completely without retrying as I had expected:

$ export AWS_ACCESS_KEY_ID=ABCDEFGHIJKLMNOPQRST
$ export AWS_ACCESS_KEY=$AWS_ACCESS_KEY_ID
$ export AWS_SECRET_ACCESS_KEY=1234567890abcdefghijklmnopqrstuvwxyzABCD

$ export AWS_SECRET_KEY=$AWS_SECRET_ACCESS_KEY

git rev-parse --short 205bd3609aa25e58aff218627bf4ab95415b8a10