added docker-host

This commit is contained in:
panda 2022-08-18 10:05:24 +02:00
parent f99f735980
commit 3601beb92b
6 changed files with 119 additions and 0 deletions

9
docker_host.yml Normal file
View file

@ -0,0 +1,9 @@
# playbook.yml:
---
- name: "docker_host"
hosts: localhost
connection: local
roles:
- docker_host

9
repo/disable_iptables.sh Executable file
View file

@ -0,0 +1,9 @@
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

3
repo/docker_daemon.json Normal file
View file

@ -0,0 +1,3 @@
{
"iptables": false
}

View file

@ -0,0 +1,50 @@
- name: Include variables
include_vars:
file: "../../../variables.yml"
- name: Install docker prerequsistes
apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- gnupg-agent
- name: Add docker repo key
shell: curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
- name: add repo for docker
shell: echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
- name: Update repositories cache
apt:
update_cache: yes
- name: Creates directory
file:
path: /etc/docker
state: directory
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: ../../../repo/docker_daemon.json
dest: /etc/docker/daemon.json
owner: root
group: root
mode: '0644'
- name: install docker
apt:
pkg:
- docker-ce
#install compose:
- name: download compose
# shell: curl -L https://github.com/docker/compose/releases/download/{{ compose_ver }}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
shell: curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep docker-compose-linux-x86_64 | grep -v sha256 | cut -d '"' -f 4 | wget -O /usr/local/bin/docker-compose -qi -
- name: make compose executable
shell: chmod +x /usr/local/bin/docker-compose

View file

@ -0,0 +1,13 @@
---
- include: ubuntu.yml
when: ansible_distribution == 'Ubuntu'
# tags: package
- include: debian.yml
when: ansible_distribution == 'Debian'
## tags: package
#- include: redhat.yml
# when: ansible_os_family == 'RedHat'
## tags: package

View file

@ -0,0 +1,35 @@
- name: Include variables
include_vars:
file: "../../../variables.yml"
- name: Install docker prerequsistes
apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- name: Add docker repo key
shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
- name: add repo for docker
shell: echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | tee /etc/apt/sources.list.d/docker.list
- name: Update repositories cache
apt:
update_cache: yes
- name: telegraf
apt:
pkg:
- docker-ce
#install compose:
- name: download compose
# shell: curl -L https://github.com/docker/compose/releases/download/{{ compose_ver }}/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
shell: curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep docker-compose-linux-x86_64 | grep -v sha256 | cut -d '"' -f 4 | wget -O /usr/local/bin/docker-compose -qi -
- name: make compose executable
shell: chmod +x /usr/local/bin/docker-compose