mirror of
https://codeberg.org/scottslowe/learning-tools.git
synced 2026-03-11 09:04:37 +00:00
Add systemd compatibility
Remove old Upstart job file. Add systemd unit file. Edit Consul configuration file template to address systemd compatibility. Modify Ansible playbook to address systemd compatibility. Add missing OVN setup script. Remove unneeded files. Signed-off-by: Scott S. Lowe <scott.lowe@scottlowe.org>
This commit is contained in:
parent
d581dba3a8
commit
72a72560fb
6 changed files with 40 additions and 35 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
{
|
||||
"advertise_addr": "{{ hostvars[inventory_hostname]['ansible_enp0s8']['ipv4']['address'] }}",
|
||||
"bind_addr": "{{ hostvars[inventory_hostname]['ansible_enp0s8']['ipv4']['address'] }}",
|
||||
"bootstrap_expect": 3,
|
||||
"client_addr": "0.0.0.0",
|
||||
"datacenter": "dc1",
|
||||
|
|
|
|||
17
ovn-docker-ansible/consul-server.service
Normal file
17
ovn-docker-ansible/consul-server.service
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Consul Server
|
||||
Requires=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=consul
|
||||
Group=consul
|
||||
Environment="GOMAXPROCS=2"
|
||||
Restart=on-failure
|
||||
RestartSec=1
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
KillSignal=SIGINT
|
||||
ExecStart=/usr/local/bin/consul agent -config-dir=/etc/consul.d/server
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
description "Consul server process"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
respawn
|
||||
|
||||
script
|
||||
if [ -f "/etc/service/consul" ]; then
|
||||
. /etc/service/consul
|
||||
fi
|
||||
|
||||
export GOMAXPROCS=`nproc`
|
||||
BIND_ADDR=`hostname -I | cut -f2 -d' '`
|
||||
|
||||
exec /usr/local/bin/consul agent \
|
||||
-config-dir="/etc/consul.d/server" \
|
||||
-bind $BIND_ADDR \
|
||||
${CONSUL_FLAGS} \
|
||||
>>/var/log/consul.log 2>&1
|
||||
end script
|
||||
|
|
@ -72,10 +72,10 @@
|
|||
tags:
|
||||
- consul
|
||||
|
||||
- name: Install Upstart script for Consul
|
||||
- name: Install systemd unit for Consul
|
||||
copy:
|
||||
src: "consul.conf"
|
||||
dest: "/etc/init/consul.conf"
|
||||
src: "consul-server.service"
|
||||
dest: "/etc/systemd/system/consul-server.service"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
|
|
@ -92,9 +92,12 @@
|
|||
tags:
|
||||
- consul
|
||||
|
||||
- name: Reload systemd units
|
||||
command: "systemctl daemon-reload"
|
||||
|
||||
- name: Start Consul service
|
||||
service:
|
||||
name: "consul"
|
||||
name: "consul-server"
|
||||
state: "started"
|
||||
tags:
|
||||
- consul
|
||||
|
|
@ -188,6 +191,7 @@
|
|||
with_items:
|
||||
- "ovn-common"
|
||||
- "ovn-host"
|
||||
- "ovn-docker"
|
||||
- "openvswitch-common"
|
||||
- "openvswitch-switch"
|
||||
tags:
|
||||
|
|
|
|||
14
ovn-docker-ansible/setup.sh.j2
Normal file
14
ovn-docker-ansible/setup.sh.j2
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Stop the ovn-controller daemon
|
||||
sudo /usr/share/openvswitch/scripts/ovn-ctl stop_controller
|
||||
|
||||
# Configure OVS
|
||||
sudo ovs-vsctl set Open_vSwitch . \
|
||||
external_ids:ovn-remote="tcp:192.168.100.101:6642" \
|
||||
external_ids:ovn-nb="tcp:192.168.100.101:6641" \
|
||||
external_ids:ovn-encap-ip={{ ansible_enp0s8.ipv4.address }} \
|
||||
external_ids:ovn-encap-type="geneve"
|
||||
|
||||
# Start the ovn-controller daemon
|
||||
sudo /usr/share/openvswitch/scripts/ovn-ctl start_controller
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
---
|
||||
- hosts: "all"
|
||||
become: "yes"
|
||||
remote_user: "vagrant"
|
||||
|
||||
tasks:
|
||||
- name: Update package cache
|
||||
apt:
|
||||
update_cache: "yes"
|
||||
cache_valid_time: "3600"
|
||||
Loading…
Reference in a new issue