From 7852eef5a6d0eefc5914f178549f6845857a5c49 Mon Sep 17 00:00:00 2001 From: LUXEY Adrien Date: Tue, 23 Mar 2021 17:00:27 +0100 Subject: WIP: improving Ansible config while I install my HammerHead - added files... --- os/config/hammerhead_inventory.yml | 17 +++++++ os/config/roles/common/tasks/docker.yml | 75 ++++++++++++++++++++++++++++++ os/config/roles/common/tasks/hashicorp.yml | 24 ++++++++++ 3 files changed, 116 insertions(+) create mode 100644 os/config/hammerhead_inventory.yml create mode 100644 os/config/roles/common/tasks/docker.yml create mode 100644 os/config/roles/common/tasks/hashicorp.yml diff --git a/os/config/hammerhead_inventory.yml b/os/config/hammerhead_inventory.yml new file mode 100644 index 0000000..dd2117e --- /dev/null +++ b/os/config/hammerhead_inventory.yml @@ -0,0 +1,17 @@ +cluster_nodes: + hosts: + hammerhead: + ansible_host: ns3118584.ip-5-135-179.eu + ansible_port: 110 + ansible_user: root + ansible_ssh_private_key_file: /home/adrien/.ssh/hammerhead + ansible_become: true + ipv4: 5.135.179.11 + gatewayv4: 5.135.179.254 + ipv6: 2001:41d0:8:ba0b::1 + gatewayv6: fe80::264:40ff:fe3a:fac0 + interface: eno1 + dns_1: 213.186.33.99 + dns_2: 172.104.136.243 + ansible_python_interpreter: python3 + ssh_port: 110 diff --git a/os/config/roles/common/tasks/docker.yml b/os/config/roles/common/tasks/docker.yml new file mode 100644 index 0000000..a688f4b --- /dev/null +++ b/os/config/roles/common/tasks/docker.yml @@ -0,0 +1,75 @@ +# From the official Docker installation guide for Debian: +# https://docs.docker.com/engine/install/debian/ + +# Uninstall old Docker versions +# $ sudo apt-get remove docker docker-engine docker.io containerd runc +- name: "Remove old Docker versions" + ansible.builtin.apt: + state: absent + name: + - docker + - docker-engine + - docker.io + - containerd + - runc + +# Install dependencies +# > apt-transport-https ca-certificates curl gnupg lsb-release +- name: "Install Docker dependencies" + ansible.builtin.apt: + state: present + name: + - apt-transport-https + - ca-certificates + # - curl # Already installed in main.yml + - gnupg + - lsb-release + +# Dowload Docker's official GPG key +# $ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg +- name: "Add Docker's official GPG key to apt" + ansible.builtin.apt_key: + id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 + url: https://download.docker.com/linux/debian/gpg + # Key destination path + keyring: /usr/share/keyrings/docker-archive-keyring.gpg + state: present + + +# Add Docker's repository to apt +# $ echo \ +# "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ +# $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +- name: "Add Docker's repository to APT sources list" + ansible.builtin.apt_repository: + repo: "deb [arch={{ architecture_map[ansible_architecture] }} signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable" + state: present + vars: + architecture_map: + "x86_64": "amd64" + "aarch64": "arm64" + "aarch": "arm64" + "armhf": "armhf" + "armv7l": "armhf" + +# Install Docker engine +# $ sudo apt-get update +# $ sudo apt-get install docker-ce docker-ce-cli containerd.io +- name: "Install Docker engine" + ansible.builtin.apt: + state: present + update_cache: yes + name: + - docker-ce + - docker-ce-cli + - containerd.io + +# Install docker-compose +# $ sudo curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +- name: "Install Docker Compose" + ansible.builtin.get_url: + url: "https://github.com/docker/compose/releases/download/{{ compose_version }}/docker-compose-{{ ansible_system }}-{{ ansible_architecture }}" + dest: /usr/local/bin/docker-compose + mode: "0755" + vars: + compose_version: 1.28.5 \ No newline at end of file diff --git a/os/config/roles/common/tasks/hashicorp.yml b/os/config/roles/common/tasks/hashicorp.yml new file mode 100644 index 0000000..9cf647b --- /dev/null +++ b/os/config/roles/common/tasks/hashicorp.yml @@ -0,0 +1,24 @@ +- name: "Add Hashicorps's official GPG key to apt" + ansible.builtin.apt_key: + url: https://apt.releases.hashicorp.com/gpg + state: present + +- name: "Add Hashicorp's repository to APT sources list" + ansible.builtin.apt_repository: + repo: "deb [arch={{ architecture_map[ansible_architecture] }}] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main" + state: present + vars: + architecture_map: + "x86_64": "amd64" + "aarch64": "arm64" + "aarch": "arm64" + "armhf": "armhf" + "armv7l": "armhf" + +- name: "Install Nomad & Consul" + ansible.builtin.apt: + state: present + update_cache: yes + name: + - nomad + - consul \ No newline at end of file -- cgit v1.2.3