Move docker to roles

This commit is contained in:
pgrondek 2020-05-26 00:08:01 +02:00
parent 3200471f68
commit 7357ea4392
12 changed files with 87 additions and 76 deletions

View File

@ -1,38 +0,0 @@
---
- name: install docker
hosts: node-x86.lan
become_method: sudo
become_user: root
become: yes
tasks:
- name: install needed packages
apt:
update_cache: yes
pkg:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- name: add docker gpg key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: add docker repo
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu {{release}} stable
state: present
filename: docker
- name: install docker
apt:
update_cache: yes
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- name: add current user to docker group
user:
name: "{{ansible_user_id}}"
groups: docker
append: yes

View File

@ -1,30 +0,0 @@
---
- name: setup nfs-client
hosts: docker_swarm
become_method: sudo
become_user: root
become: yes
tasks:
- name: install nfs-client
apt:
update_cache: yes
pkg:
- nfs-common
- name: update rpc config
copy:
src: rpc-statd.service
dest: /lib/systemd/system/rpc-statd.service
- name: stop and disable rpc
systemd:
name: rpc-statd
state: stopped
enabled: false
- name: start and enable rpc
systemd:
name: rpc-statd
state: started
enabled: true

View File

@ -6,7 +6,7 @@ all:
prusa.lan: prusa.lan:
iron-man.lan: iron-man.lan:
children: children:
docker_swarm: docker_cluster:
hosts: hosts:
node-01.lan: node-01.lan:
docker_node: node-01 docker_node: node-01

View File

@ -6,3 +6,7 @@
- hosts: prusa.lan - hosts: prusa.lan
roles: roles:
- octoprint - octoprint
- hosts: docker_cluster
roles:
- docker-cluster

View File

@ -1,11 +1,6 @@
--- ---
- name: install and configure heartbeat - become: yes
hosts: docker_swarm block:
become_method: sudo
become_user: root
become: yes
tasks:
- name: install heartbeat - name: install heartbeat
apt: apt:
update_cache: yes update_cache: yes

View File

@ -0,0 +1,37 @@
---
- become: yes
block:
- name: install needed packages
apt:
update_cache: yes
pkg:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- name: add docker gpg key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: add docker repo
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu {{release}} stable
state: present
filename: docker
- name: install docker
apt:
update_cache: yes
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- name: add current user to docker group
user:
name: "{{ansible_user_id}}"
groups: docker
append: yes

View File

@ -0,0 +1,7 @@
---
- name: install needed packages
become: yes
apt:
update_cache: yes
pkg:
- docker.io

View File

@ -0,0 +1,11 @@
---
- import_tasks: install-docker-ce.yml
when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "18.04"
- import_tasks: install-docker-io.yml
when: ansible_distribution == "Ubuntu" and ansible_distribution_version != "18.04"
- import_tasks: nfs-client.yml
- import_tasks: hearthbeat.yml

View File

@ -0,0 +1,25 @@
---
- become: yes
block:
- name: install nfs-client
apt:
update_cache: yes
pkg:
- nfs-common
- name: update rpc config
copy:
src: lib/systemd/system/rpc-statd.service
dest: /lib/systemd/system/rpc-statd.service
- name: stop and disable rpc
systemd:
name: rpc-statd
state: stopped
enabled: false
- name: start and enable rpc
systemd:
name: rpc-statd
state: started
enabled: true