Commit ef5256cd by Heechul Kim

Merge branch 'master' of https://git.iorchard.co.kr/jijisa/porch

parents 9c056a8c 3b2a8183
---
# This playbook deploys BIND
- name: Ensure the 'Developemnt tools' package group installed.
yum:
name: "@Development tools"
state: present
- name: Ensure the openssl-devel package installed
yum:
name: openssl-devel
state: present
- name: Ensure the bind-utils package installed
yum:
name: bind-utils
state: present
- name: Get bind source tarball from ftp://ftp.isc.org.
get_url:
url: http://ftp.isc.org/isc/bind9/{{ d['tag'] }}/bind-{{ d['tag'] }}.tar.gz
dest: /tmp/bind-{{ d['tag'] }}.tar.gz
- name: untar the source tarball to managed node's /tmp.
unarchive:
src: /tmp/bind-{{ d['tag'] }}.tar.gz
dest: /tmp
remote_src: True
- name: configure bind.
shell: ./configure --prefix=/var/named-{{ d['tag'] }} --with-openssl=/usr --sysconfdir=/etc --enable-ipv6 --enable-threads
args:
chdir: /tmp/bind-{{ d['tag'] }}
- name: make bind.
shell: make -j {{ ansible_processor_vcpus }}
args:
chdir: /tmp/bind-{{ d['tag'] }}
- name: make install bind.
shell: make install
args:
chdir: /tmp/bind-{{ d['tag'] }}
- name: Clean untarred source
file:
path: /tmp/bind-{{ d['tag'] }}
state: absent
- name: Create named user.
user:
name: named
shell: /sbin/nologin
createhome: no
- name: Check if named is running.
command: pidof named
register: is_named_running
ignore_errors: True
- name: kill named process
shell: kill -9 $(pidof named)
when: is_named_running.rc == 0
- name: Delete /usr/sbin/named.
file:
path: /usr/sbin/named
state: absent
ignore_errors: True
- name: Delete /usr/sbin/rndc.
file:
path: /usr/sbin/rndc
state: absent
ignore_errors: True
- name: Symlink named.
file:
src: /var/named-{{ d['tag'] }}/sbin/named
dest: /usr/sbin/named
state: link
- name: Symlink rndc.
file:
src: /var/named-{{ d['tag'] }}/sbin/rndc
dest: /usr/sbin/rndc
state: link
- name: Make directory log
file:
path: /var/named-{{ d['tag'] }}/log
state: directory
- name: Copy named.local.
copy:
src: named.local
dest: /var/named-{{ d['tag'] }}/named.local
- name: Copy named.root.
copy:
src: named.root
dest: /var/named-{{ d['tag'] }}/named.root
- name: Copy named.conf.
copy:
src: named.conf
dest: /etc/named.conf
- name: Copy rndc.conf.
copy:
src: rndc.conf
dest: /etc/rndc.conf
- name: Copy rndc.key
copy:
src: rndc.key
dest: /etc/rndc.key
- name: Copy cnsdns.sh.
copy:
src: cnsdns.sh
dest: /home/cnsdns.sh
mode: 0755
- name: Check to see if /etc/named.conf exists.
stat:
path: /etc/named.conf
register: st
- name: Touch /etc/named.conf if not exist.
file:
path: /etc/named.conf
state: touch
when: st.stat.exists == False
- name: Change ownership of /var/named-{{ d['tag'] }} to named:named
command: chown -R named:named /var/named-{{ d['tag'] }}
- name: Change mode of /var/named-{{ d['tag'] }}
command: chmod 744 /var/named-{{ d['tag'] }}
- name: Change mode of /etc/named.conf
command: chmod 766 /etc/named.conf
- name: sed named.conf.
command: sed -i s/named-version/named-{{ d['tag'] }}/g /etc/named.conf
- name: sed cnsdns.sh.
command: sed -i s/named-version/named-{{ d['tag'] }}/g /home/cnsdns.sh
- name: Copy named.service systemd file.
copy:
src: named.service
dest: /etc/systemd/system/named.service
- name: Added Cron Job
shell: echo "*/5 * * * * /home/cnsdns.sh" > /var/spool/cron/root
- name: Generate ssh key
user:
name: root
generate_ssh_key: yes
ssh_key_bits: 2048
ssh_key_file: .ssh/id_rsa
- name: Reload systemd.
command: systemctl daemon-reload
- name: Enable named service.
command: systemctl enable named.service
- name: Run named service.
command: systemctl start named.service
- shell: named -v
register: version
- shell: ps -ef | grep named | grep -v grep
register: process
{% raw %}
- name: Check named version
debug:
msg: "bind version : '{{ version.stdout }}'"
- name: Check named process
debug:
msg: "check process : '{{ process.stdout }}'"
{% endraw %}
---
# This playbook deploys BIND
- name: Install bind(Wireless DNS Team)
hosts: all
roles:
- bind-wireless
environment:
http_proxy: http://{{ d['proxy_url'] }}:{{ d['proxy_port'] }}
...
auto {{ d['svc_nic'] }}
iface {{ d['svc_nic'] }} inet static
{% set nics = d['svc_nic'].split() %}
{% if nics|length > 1 %}
{% for nic in nics %}
allow-hotplug {{ nic }}
iface {{ nic }} inet manual
{% endfor %}
auto bond1
iface bond1 inet manual
slaves {{ d['svc_nic'] }}
bond-mode active-backup
bond-miimon 100
bond-downdelay 200
bond-updelay 200
auto xenbr1
iface xenbr1 inet static
bridge_ports bond1
bridge_maxwait 5
address {{ d['svc_ip'] }}
netmask {{ d['svc_netmask'] }}
gateway {{ d['svc_gateway'] }}
{% else %}
auto xenbr1
iface xenbr1 inet static
bridge_ports {{ nics|first }}
bridge_maxwait 5
address {{ d['svc_ip'] }}
netmask {{ d['svc_netmask'] }}
gateway {{ d['svc_gateway'] }}
{% endif %}
......@@ -35,7 +35,7 @@ then
cat $FAI/svc-interface >> $target/etc/network/interfaces
else
echo "No svc-interface. So set gateway on NIC1."
echo " gateway $GATEWAY" >> $target/etc/network/interfaces
echo " gateway $GATEWAYS" >> $target/etc/network/interfaces
fi
# here fcopy is mostly used, when installing a client for running in a
......
......@@ -41,4 +41,7 @@ ainsl -av /etc/fai/fai.conf "FAI_CONFIG_SRC=$FAI_CONFIG_SRC"
fcopy -Miv /etc/fai/fai.conf
$ROOTCMD systemctl start getty@ttyS0.service
$ROOTCMD systemctl enable serial-getty@ttyS0.service
exit $error
......@@ -11,9 +11,6 @@ if [ -z "$BOOT_DEVICE" ]; then
exit 189
fi
# disable os-prober because of #788062
ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true'
# skip the rest, if not an initial installation
if [ $FAI_ACTION != "install" ]; then
$ROOTCMD update-grub
......@@ -37,6 +34,19 @@ else
echo "Grub installed on $BOOT_DEVICE = $GROOT"
fi
fi
# GRUB2 and Jessie with serial console
sed -i "/GRUB_CMDLINE_LINUX_DEFAULT/d" $target/etc/default/grub
sed -i "/GRUB_CMDLINE_LINUX/d" $target/etc/default/grub
ainsl /etc/default/grub 'GRUB_CMDLINE_LINUX_DEFAULT=""'
ainsl /etc/default/grub 'GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200"'
ainsl /etc/default/grub 'GRUB_TERMINAL="console serial"'
ainsl /etc/default/grub 'GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"'
# disable os-prober because of #788062
ainsl /etc/default/grub 'GRUB_DISABLE_OS_PROBER=true'
$ROOTCMD update-grub
exit $error
......@@ -20,8 +20,8 @@ echo "Finish to install blktap-utils." >> $LOGFILE
INTERFACES="$target/etc/network/interfaces"
if [ -f $INTERFACES ]
then
ETH=`grep '^iface.*eth' $INTERFACES|awk '{print $2}' | cut -c 4`
for ETH_NO in $ETH;do perl -pi.bak -e "s/eth$ETH_NO inet static/eth$ETH_NO inet manual\\nauto xenbr$ETH_NO\\niface xenbr$ETH_NO inet static\\n \tbridge_ports eth$ETH_NO\\n \tbridge_maxwait 5/g" $INTERFACES;done
ETH_NO=`grep "^iface.*$NIC1" $INTERFACES|awk '{print $2}' | cut -c 4`
perl -pi.bak -e "s/$NIC1 inet static/$NIC1 inet manual\\nauto xenbr$ETH_NO\\niface xenbr$ETH_NO inet static\\n bridge_ports $NIC1\\n bridge_maxwait 5/g" $INTERFACES
echo "Finish to set up xen bridge in $INTERFACES." >> $LOGFILE
else
echo "interfaces file is not found($INTERFACES)." >> $LOGFILE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment