From df2b2d74177b9af23d6623418976f365230bf804 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=96zg=C3=BCr=20Caner?= <oc@teuto.net>
Date: Mon, 5 Sep 2016 10:45:27 +0200
Subject: [PATCH] Added bootstrap script for Ubuntu 16.04 LTS and later

---
 roles/ubuntu-bootstrap/defaults/main.yml |  2 ++
 roles/ubuntu-bootstrap/tasks/main.yml    | 14 ++++++++++++++
 ubuntu-bootstrap.yml                     |  5 +++++
 3 files changed, 21 insertions(+)
 create mode 100644 roles/ubuntu-bootstrap/defaults/main.yml
 create mode 100644 roles/ubuntu-bootstrap/tasks/main.yml
 create mode 100644 ubuntu-bootstrap.yml

diff --git a/roles/ubuntu-bootstrap/defaults/main.yml b/roles/ubuntu-bootstrap/defaults/main.yml
new file mode 100644
index 000000000..0de237cfa
--- /dev/null
+++ b/roles/ubuntu-bootstrap/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+bootstrap_versions: Ubuntu 1[6-9]\|2[0-9]\.
\ No newline at end of file
diff --git a/roles/ubuntu-bootstrap/tasks/main.yml b/roles/ubuntu-bootstrap/tasks/main.yml
new file mode 100644
index 000000000..317243773
--- /dev/null
+++ b/roles/ubuntu-bootstrap/tasks/main.yml
@@ -0,0 +1,14 @@
+---
+#  raw: cat /etc/issue.net | grep '{{ bootstrap_versions }}'
+
+- name: Bootstrap | Check if bootstrap is needed
+  raw: which python
+  register: need_bootstrap
+  ignore_errors: True
+
+- name: Bootstrap | Install python 2.x
+  raw: DEBIAN_FRONTEND=noninteractive apt install -y python-minimal
+  when: need_bootstrap | failed
+
+- set_fact:
+    ansible_python_interpreter: "/usr/bin/python"
\ No newline at end of file
diff --git a/ubuntu-bootstrap.yml b/ubuntu-bootstrap.yml
new file mode 100644
index 000000000..b6adf783d
--- /dev/null
+++ b/ubuntu-bootstrap.yml
@@ -0,0 +1,5 @@
+---
+- hosts: all
+  gather_facts: False
+  roles:
+    - ubuntu-bootstrap
-- 
GitLab