-
Notifications
You must be signed in to change notification settings - Fork 22
/
redhat-7.yml
111 lines (104 loc) · 3 KB
/
redhat-7.yml
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
system_config_dir: "/etc/sysconfig"
systemd_utils_prefix: "/lib/systemd"
# Required rpm packages.
lxc_hosts_distro_packages:
- aria2
- bridge-utils
- btrfs-progs
- dbus
- debootstrap
- dnsmasq
- git
- libseccomp
- libselinux
- libselinux-devel
- lxc
- lxc-devel
- lxc-libs
- lxc-templates
- policycoreutils-python
- selinux-policy-devel
- unzip
- xz
lxc_xz_bin: xz
lxc_cache_map:
distro: centos
arch: amd64
release: 7
copy_from_host:
- /etc/environment
- /etc/localtime
- /etc/pki/rpm-gpg/
- /etc/yum/pluginconf.d/fastestmirror.conf
- /etc/yum.repos.d/
cache_prep_commands: |
{{ lxc_cache_prep_pre_commands }}
mkdir -p /etc/ansible/facts.d/
if [ -a /etc/resolv.conf ]; then
mv /etc/resolv.conf /etc/resolv.conf.org
fi
{% for resolver in lxc_cache_prep_dns %}
echo "nameserver {{ resolver }}" >> /etc/resolv.conf
{% endfor %}
rpm --import /etc/pki/rpm-gpg/*
# Prefer dnf over yum for CentOS.
which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
# Create yum/dnf transaction file and run it all at once
echo "update" > /tmp/package-transaction.txt
echo "install {{ lxc_cache_distro_packages | join(' ') }}" >> /tmp/package-transaction.txt
echo "run" >> /tmp/package-transaction.txt
$RHT_PKG_MGR -y shell /tmp/package-transaction.txt
rm -f /tmp/package-transaction.txt
rm -f /usr/bin/python
ln -s /usr/bin/python2.7 /usr/bin/python
yum clean all
mkdir -p /var/backup
echo -e '{{ lxc_container_default_interfaces }}' | tee /etc/sysconfig/network-scripts/ifcfg-eth0
chage -I -1 -d -1 -m 0 -M 99999 -E -1 root
if [ -a /etc/resolv.conf.org ]; then
mv /etc/resolv.conf.org /etc/resolv.conf
else
rm -f /etc/resolv.conf
fi
{{ lxc_cache_prep_post_commands }}
_lxc_cache_distro_packages:
- ca-certificates
- cronie
- epel-release
- openssh-server
- python2
- rsync
- sudo
- systemd-networkd
- tar
- wget
- which
- yum-plugin-priorities
- yum-utils
lxc_cached_network_interfaces:
- src: "lxc-net-redhat-bridge.cfg.j2"
dest: "/etc/sysconfig/network-scripts/ifcfg-{{ lxc_net_bridge }}"
- src: "lxc-net-suseredhat-postdown.cfg.j2"
dest: "/etc/sysconfig/network-scripts/ifdown-post-{{ lxc_net_bridge }}"
mode: "0755"
interface: "${DEVICE}"
lxc_container_default_interfaces: |
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=no
TYPE=Ethernet