From 55d1e0c1059718f02026734a4c1bef539b93b385 Mon Sep 17 00:00:00 2001 From: Blallo Date: Wed, 4 Dec 2024 23:49:00 +0100 Subject: [PATCH] init --- ansible.cfg | 4 ++++ create-role.sh | 13 +++++++++++++ inventory.yml | 15 +++++++++++++++ playbooks/base.yml | 4 ++++ roles/base/defaults/main.yml | 0 roles/base/files/main.yml | 0 roles/base/handlers/main.yml | 0 roles/base/tasks/docker.yml | 30 ++++++++++++++++++++++++++++++ roles/base/tasks/main.yml | 1 + roles/base/templates/main.yml | 0 10 files changed, 67 insertions(+) create mode 100644 ansible.cfg create mode 100755 create-role.sh create mode 100644 inventory.yml create mode 100644 playbooks/base.yml create mode 100644 roles/base/defaults/main.yml create mode 100644 roles/base/files/main.yml create mode 100644 roles/base/handlers/main.yml create mode 100644 roles/base/tasks/docker.yml create mode 100644 roles/base/tasks/main.yml create mode 100644 roles/base/templates/main.yml diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..15fefe3 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,4 @@ +[defaults] +interpreter_python = /usr/bin/python3 +ansible_python_interpreter = /usr/bin/python3 +roles_path = ./roles/:~/.ansible/roles:/etc/ansible/roles diff --git a/create-role.sh b/create-role.sh new file mode 100755 index 0000000..7a8c633 --- /dev/null +++ b/create-role.sh @@ -0,0 +1,13 @@ +#!/usr/bin/bash + +if [ $# -ne 1 ]; then + echo "$0 " +fi + +ROLE="${1}" + +mkdir roles/${ROLE} + +mkdir roles/${ROLE}/{defaults,handlers,tasks,templates,files} + +touch roles/${ROLE}/{defaults,handlers,tasks,templates,files}/main.yml diff --git a/inventory.yml b/inventory.yml new file mode 100644 index 0000000..1f0a03a --- /dev/null +++ b/inventory.yml @@ -0,0 +1,15 @@ +--- +all: + hosts: + houdini: + ansible_host: houdini.abbiamoundominio.org + ranma: + ansible_host: 109.123.246.23 + + children: + dev: + hosts: + houdini: {} + prod: + hosts: + ranma: {} diff --git a/playbooks/base.yml b/playbooks/base.yml new file mode 100644 index 0000000..c949829 --- /dev/null +++ b/playbooks/base.yml @@ -0,0 +1,4 @@ +--- +- hosts: all + roles: + - base diff --git a/roles/base/defaults/main.yml b/roles/base/defaults/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/roles/base/files/main.yml b/roles/base/files/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/roles/base/handlers/main.yml b/roles/base/handlers/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/roles/base/tasks/docker.yml b/roles/base/tasks/docker.yml new file mode 100644 index 0000000..9606fe8 --- /dev/null +++ b/roles/base/tasks/docker.yml @@ -0,0 +1,30 @@ +--- +- name: Install required packages + apt: + name: + - apt-transport-https + - ca-certificates + - curl + - gnupg2 + - software-properties-common + +- name: Add Docker GPG key + apt_key: + url: https://download.docker.com/linux/debian/gpg + state: present + +- name: Add Docker repository + apt_repository: + repo: deb [arch=amd64] https://download.docker.com/linux/debian bookworm stable + state: present + +- name: Install Docker Engine + apt: + name: + - docker-ce + - docker-ce-cli + - containerd.io + +- name: Start Docker service + service: + name: docker diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml new file mode 100644 index 0000000..6801134 --- /dev/null +++ b/roles/base/tasks/main.yml @@ -0,0 +1 @@ +- include_tasks: docker.yml diff --git a/roles/base/templates/main.yml b/roles/base/templates/main.yml new file mode 100644 index 0000000..e69de29