summaryrefslogtreecommitdiff
path: root/salt/gentoo_baseimage/ci/files/cloudcfg.sh
blob: 400f7cfd8c36b90da424b72f8c4e3b8075a66ada (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

# Prepare the instance for ansible. This amounts to installing python2.

python=$(which python || which python3 || which python2 || false)

case "$(${python} -m platform)" in
    *Ubuntu*)
        export DEBIAN_FRONTEND=noninteractive
        apt-get update
        apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
        apt-get -y install aptitude python python2.7 python3-netaddr ntp ntpdate language-pack-de
        update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
        update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
        update-alternatives --set python /usr/bin/python3.6
        ;;
    *centos*|*redhat*)
        # RHEL systems still use python2 by default; nothing to do
        ;;
    *gentoo*)
        if [ ! -d /usr/portage/sys-devel/gcc ]; then
            emerge-webrsync
        fi
        emerge --oneshot --update dev-lang/python:2.7 app-portage/gentoolkit net-misc/chrony
        rc-update add chrony default
        ;;
esac

exit 0