Move docker to roles
This commit is contained in:
parent
3200471f68
commit
7357ea4392
@ -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
|
|
@ -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
|
|
@ -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
|
||||||
|
4
main.yml
4
main.yml
@ -6,3 +6,7 @@
|
|||||||
- hosts: prusa.lan
|
- hosts: prusa.lan
|
||||||
roles:
|
roles:
|
||||||
- octoprint
|
- octoprint
|
||||||
|
|
||||||
|
- hosts: docker_cluster
|
||||||
|
roles:
|
||||||
|
- docker-cluster
|
||||||
|
@ -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
|
37
roles/docker-cluster/tasks/install-docker-ce.yml
Normal file
37
roles/docker-cluster/tasks/install-docker-ce.yml
Normal 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
|
7
roles/docker-cluster/tasks/install-docker-io.yml
Normal file
7
roles/docker-cluster/tasks/install-docker-io.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: install needed packages
|
||||||
|
become: yes
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
pkg:
|
||||||
|
- docker.io
|
11
roles/docker-cluster/tasks/main.yml
Normal file
11
roles/docker-cluster/tasks/main.yml
Normal 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
|
||||||
|
|
25
roles/docker-cluster/tasks/nfs-client.yml
Normal file
25
roles/docker-cluster/tasks/nfs-client.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user