Skip to content

Instantly share code, notes, and snippets.

@andrewheiss
Created January 29, 2024 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewheiss/347bd941ac81dcb762a654f8689bd15d to your computer and use it in GitHub Desktop.
Save andrewheiss/347bd941ac81dcb762a654f8689bd15d to your computer and use it in GitHub Desktop.
---
- hosts: ubuntu
become: yes
tasks:
- name: Add a new user named 'yourname'
user:
name: yourname
state: present
- name: Add 'yourname' to sudo group
user:
name: yourname
groups: sudo
append: yes
- name: Install ufw
apt:
name: ufw
state: present
- name: Allow OpenSSH in ufw
ufw:
rule: allow
name: OpenSSH
- name: Enable ufw
ufw:
state: enabled
- name: Install Docker dependencies
apt:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- name: Add Docker's official GPG key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker's official apt repository
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
state: present
- name: Install Docker
apt:
name: docker-ce
state: present
update_cache: yes
- name: Install Docker Compose
get_url:
url: https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m`
dest: /usr/local/bin/docker-compose
mode: '0755'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment