Docker initial config

This commit is contained in:
Fabio Sinibaldi 2025-05-07 18:28:48 +02:00
parent eb1b46c8d9
commit a339071b1d
5 changed files with 82 additions and 6 deletions

View File

@ -1,7 +1,9 @@
$ANSIBLE_VAULT;1.1;AES256
61393961306333653235623830613237633236393333343663613032653136373237316361643439
3033653166663836363961663535396631653336653264330a643131393433376239633933613661
34346235343936313434646533653261653334356239636431323338383538393964313666636233
6235623436656430390a316639343438366436643935373162613135323034626339393539323433
36363630643163666632306234386664323166373638353339663563333232663135383531336266
3231326238326136323536383434383134313739643239623964
39376138666334356631626564333933643938353065356235303636303064353263623831373036
3461386536336466343665343639643730653838323939370a343737663839623962373065313932
64623636646335616162633331613835613837336561666530623864346431363338653564323539
3863656661653538390a623763636564383863643063353364366232663133326235353136626661
31623736323938663561363562323832373939303637633337626132616530343731343037303062
66376330613130323331363230626361383137393333326661343239613137386530666237393661
38303330386663393334323735636637393262616664646536343865613431666234343566616661
38323163383866353034

View File

@ -0,0 +1,24 @@
---
- name: Add the docker group
group:
name: docker
gid: 1101
state: present
- name: Add the docker user
user:
name: docker
uid: 1101
group: docker
# Directly generate hash
# https://www.lisenet.com/2019/ansible-generate-crypted-passwords-for-the-user-module/
password: "{{ docker_crypted_password | password_hash('sha512') }}"
shell: /bin/bash
system: yes
home: /srv/docker
state: present
- name: Reset ssh connection to allow user changes to affect ansible user
ansible.builtin.meta:
reset_connection

View File

@ -0,0 +1,40 @@
---
- name: Install aptitude
apt:
name: aptitude
state: latest
update_cache: true
- name: Install required system packages
apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- python3-pip
- virtualenv
- python3-setuptools
state: latest
update_cache: true
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Update apt and install docker-ce
apt:
name: docker-ce
state: latest
update_cache: true
- name: Install Docker Module for Python
pip:
name: docker

View File

@ -0,0 +1,4 @@
---
# configure as master if flag
# identify swarm by node variable
become_user: docker

6
ansible/swarms.yml Normal file
View File

@ -0,0 +1,6 @@
---
- name: Configure swarms
hosts: swarm
roles:
- common
- docker