Skip to content

Instantly share code, notes, and snippets.

View Zooloo2014's full-sized avatar
My old profile; new one: @brentengelbrecht

Brent Engelbrecht Zooloo2014

My old profile; new one: @brentengelbrecht
View GitHub Profile
Zooloo2014 / gist:29c7552b31f5069669caae7b5d1d2f82
Created February 18, 2019 08:35
Ansible role for checking existence of SSH key on target
- set_fact: do_token="{{ lookup('env', 'DO_API_TOKEN')}}"
- set_fact: ssh_key_name="{{ lookup('env', 'SSH_KEY_NAME')}}"
- name: ensure ssh key exists and get the key id
state: present
command: ssh
name: my_ssh_key
# tasks file for common
- name: install Python 2.x
raw: which python || sudo apt-get update && sudo apt-get install -qq -y python-simplejson
register: python_check
changed_when: not python_check.stdout is search('/usr/bin/python')
- name: install pip
name: python-pip
echo "Update packages: "
docker exec -it $containerName sh -c "yum -y update"

echo "Add epel repos"
docker exec -it $containerName sh -c "yum -y install epel-release"

echo "Install needed packages: "
docker exec -it $containerName sh -c "yum install -y git rpm-build redhat-rpm-config gcc-c++ make nodejs"