78 lines
1.7 KiB
YAML
78 lines
1.7 KiB
YAML
- name: Initialise worker VM
|
|
hosts: localhost
|
|
become: yes
|
|
vars_files:
|
|
- local_vars.yaml
|
|
- ../common_vars.yaml
|
|
|
|
tasks:
|
|
- name: Install essentials
|
|
apt:
|
|
pkg:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
- curl
|
|
- software-properties-common
|
|
- python3-pip
|
|
- virtualenv
|
|
- python3-setuptools
|
|
- vim
|
|
- git
|
|
- btop
|
|
- whois
|
|
- cifs-utils
|
|
- tree
|
|
- exa
|
|
state: latest
|
|
update_cache: true
|
|
ignore_errors: yes
|
|
|
|
- name: Add Docker GPG apt Key
|
|
apt_key:
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
state: present
|
|
tags: docker
|
|
|
|
- name: Add Docker Repository
|
|
apt_repository:
|
|
repo: deb https://download.docker.com/linux/ubuntu focal stable
|
|
state: present
|
|
tags: docker
|
|
|
|
- name: Update apt and install docker-ce
|
|
apt:
|
|
name: docker-ce
|
|
state: latest
|
|
update_cache: true
|
|
tags: docker
|
|
|
|
- name: Update ExecStart in Docker service file with exposing the port
|
|
lineinfile:
|
|
path: /lib/systemd/system/docker.service
|
|
regexp: '^ExecStart='
|
|
line: 'ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375'
|
|
state: present
|
|
tags: docker, config
|
|
|
|
- name: Reload systemd to apply changes
|
|
command: systemctl daemon-reload
|
|
tags: config
|
|
|
|
- name: Start and enable Docker
|
|
service:
|
|
name: docker
|
|
state: started
|
|
enabled: yes
|
|
tags: docker
|
|
|
|
- name: Create a login user
|
|
user:
|
|
name: "tylen"
|
|
password: "$6$OhH/TOtjPdxJgC9i$1ytWcV0yBuv5b4Momkka57tErCc4UqvG0zqydyyGQm3OXSaWPHTLHxvPjeCdA9B8T0./eXawj62xZ7gVtzokG/"
|
|
groups:
|
|
- docker
|
|
- sudo
|
|
state: present
|
|
shell: /usr/bin/zsh
|
|
tags: login
|