slim down docker container, doing everything in prepare.yml

This commit is contained in:
Dieter Verhelst 2019-03-12 12:14:10 +01:00
parent dc4d30ba7a
commit dada2d4556
2 changed files with 35 additions and 15 deletions

View File

@ -1,14 +1,10 @@
# Molecule managed # Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }} FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates cron iputils-ping openssh-client openssh-server && apt-get clean; \ RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash anacron iputils openssh-clients openssh-server && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@ -1,17 +1,41 @@
--- ---
- name: prepare servers - Debian only - name: prepare debian-based systems
hosts: borgbackup_servers hosts: all:!centos
gather_facts: true gather_facts: false
tasks: tasks:
- name: install required packages
apt:
name:
- bash
- ca-certificates
- cron
- iputils-ping
- openssh-client
- name: prepare centos-based systems
hosts: centos
gather_facts: false
tasks:
- name: install required packages
yum:
name:
- anacron
- iputils
- openssh-clients
- name: prepare debian-based backupservers
hosts: borgbackup_servers
gather_facts: false
tasks:
- name: install required packages
apt:
name:
- openssh-server
- name: start ssh - Debian Server - name: start ssh - Debian Server
command: service ssh start command: service ssh start
# note: https://forums.docker.com/t/any-simple-and-safe-way-to-start-services-on-centos7-systemd/5695/8
# needs to be implemented
# - name: start sshd
# command: service sshd start
- name: prepare all - name: prepare lamp
hosts: all:!borgbackup_servers:!centos hosts: lamp
tasks: tasks:
- name: Install required packages - name: Install required packages
apt: apt: