Skip to content

Instantly share code, notes, and snippets.

@ruXlab
Created January 12, 2020 17:59
Show Gist options
  • Save ruXlab/fdc8a192b269244301c54c72cbf18484 to your computer and use it in GitHub Desktop.
Save ruXlab/fdc8a192b269244301c54c72cbf18484 to your computer and use it in GitHub Desktop.
ansible playbook which installs docker-machine on your Raspberry PI, see https://rux.vc/2020.01/installing-docker-machine-on-raspberry-pi/
# Install docker machine on your RPi
# For more details see https://rux.vc/2020.01/installing-docker-machine-on-raspberry-pi/
---
- name: RPi initial provisioner
hosts: all
remote_user: pi
become: yes
become_user: root
tasks:
- name: "Remembering target host information"
set_fact:
target_host: "{{ ansible_host }}"
target_user: "{{ ansible_user }}"
- name: Upgrade packages
apt: upgrade=safe
- name: Temporary monkey-patching os-release
lineinfile:
path: /etc/os-release
regexp: '^ID=raspbian$'
line: ID=debian
state: present
backrefs: yes
- name: "Running docker-machine against {{ target_host }}"
become: no
register: o1
local_action:
module: shell
cmd: >
docker-machine create --driver generic
--generic-ip-address={{ target_host }}
--generic-ssh-user {{ target_user }}
--engine-storage-driver overlay2
{{ machine_name | default('rpi') }}
- name: Reverting OS name back in os-release
lineinfile:
path: /etc/os-release
regexp: '^ID=debian$'
line: ID=raspbian
state: present
backrefs: yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment