Neutron Agents json support
Neutron Agents is a special case for json support. Since it's a fat container, there will be multiple commnds that will need to be run in the container. In order to account for this, the commands will be hardcoded until the agents are split out to their own containers. The files will be copied the normal way. Co-Authored-By: Steven Dake <stdake@cisco.com> Change-Id: I9fc226cc7b82c2594db5814d30d453a29a4af8c0 Partially-Implements: blueprint replace-config-external Closes-Bug: #1500566
This commit is contained in:
parent
00151b2310
commit
4f15ac8008
@ -137,6 +137,12 @@
|
|||||||
config_dest: "{{ node_config_directory }}/{{ service_name }}/ml2_conf.ini"
|
config_dest: "{{ node_config_directory }}/{{ service_name }}/ml2_conf.ini"
|
||||||
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
|
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
|
||||||
|
|
||||||
|
- name: Copying Neutron Agents JSON configuration file
|
||||||
|
template:
|
||||||
|
src: "roles/neutron/templates/neutron-agents.json.j2"
|
||||||
|
dest: "{{ node_config_directory }}/neutron-agents/config.json"
|
||||||
|
when: inventory_hostname in groups['neutron-server']
|
||||||
|
|
||||||
- name: Copying Neutron Server JSON configuration file
|
- name: Copying Neutron Server JSON configuration file
|
||||||
template:
|
template:
|
||||||
src: "roles/neutron/templates/neutron-server.json.j2"
|
src: "roles/neutron/templates/neutron-server.json.j2"
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
image: "{{ neutron_agents_image_full }}"
|
image: "{{ neutron_agents_image_full }}"
|
||||||
volumes:
|
volumes:
|
||||||
- "/run:/run"
|
- "/run:/run"
|
||||||
- "{{ node_config_directory }}/neutron-agents/:/opt/kolla/neutron-agents/:ro"
|
- "{{ node_config_directory }}/neutron-agents/:/opt/kolla/config_files/:ro"
|
||||||
- "/var/lib/kolla/dev/log:/dev/log"
|
- "/var/lib/kolla/dev/log:/dev/log"
|
||||||
env:
|
env:
|
||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
|
41
ansible/roles/neutron/templates/neutron-agents.json.j2
Normal file
41
ansible/roles/neutron/templates/neutron-agents.json.j2
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"command": "",
|
||||||
|
"config_files": [
|
||||||
|
{
|
||||||
|
"source": "/opt/kolla/config_files/neutron.conf",
|
||||||
|
"dest": "/etc/neutron/neutron.conf",
|
||||||
|
"owner": "neutron",
|
||||||
|
"perm": "0600"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "/opt/kolla/config_files/dhcp_agent.ini",
|
||||||
|
"dest": "/etc/neutron/dhcp_agent.ini",
|
||||||
|
"owner": "neutron",
|
||||||
|
"perm": "0600"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "/opt/kolla/config_files/dnsmasq.conf",
|
||||||
|
"dest": "/etc/neutron/dnsmasq.conf",
|
||||||
|
"owner": "neutron",
|
||||||
|
"perm": "0600"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "/opt/kolla/config_files/l3_agent.ini",
|
||||||
|
"dest": "/etc/neutron/l3_agent.ini",
|
||||||
|
"owner": "neutron",
|
||||||
|
"perm": "0600"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "/opt/kolla/config_files/ml2_conf.ini",
|
||||||
|
"dest": "/etc/neutron/plugins/ml2/ml2_conf.ini",
|
||||||
|
"owner": "neutron",
|
||||||
|
"perm": "0600"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "/opt/kolla/config_files/metadata_agent.ini",
|
||||||
|
"dest": "/etc/neutron/metadata_agent.ini",
|
||||||
|
"owner": "neutron",
|
||||||
|
"perm": "0600"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -32,6 +32,8 @@ COPY neutron-dhcp-agent/ /opt/kolla/neutron-dhcp-agent
|
|||||||
COPY neutron-l3-agent/ /opt/kolla/neutron-l3-agent
|
COPY neutron-l3-agent/ /opt/kolla/neutron-l3-agent
|
||||||
COPY neutron-metadata-agent/ /opt/kolla/neutron-metadata-agent
|
COPY neutron-metadata-agent/ /opt/kolla/neutron-metadata-agent
|
||||||
|
|
||||||
CMD ["/usr/bin/supervisord"]
|
COPY start.sh /
|
||||||
|
|
||||||
|
CMD ["/start.sh"]
|
||||||
|
|
||||||
{{ include_footer }}
|
{{ include_footer }}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
SOURCES="/opt/kolla/neutron-agents/neutron.conf /opt/kolla/neutron-agents/dhcp_agent.ini /opt/kolla/neutron-agents/dnsmasq.conf"
|
|
||||||
TARGET="/etc/neutron/"
|
|
||||||
OWNER="neutron"
|
|
||||||
|
|
||||||
for f in $SOURCES; do
|
|
||||||
if [[ -f "$f" ]]; then
|
|
||||||
fname=$(basename $f)
|
|
||||||
cp $f $TARGET
|
|
||||||
chown ${OWNER}: $TARGET/$fname
|
|
||||||
chmod 0644 $TARGET/$fname
|
|
||||||
fi
|
|
||||||
done
|
|
@ -1,37 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
|
# Loading common functions.
|
||||||
|
source /opt/kolla/config-sudoers.sh
|
||||||
|
|
||||||
|
# Will be removed when neutron-agents is a thin container
|
||||||
CMD="/usr/bin/neutron-dhcp-agent"
|
CMD="/usr/bin/neutron-dhcp-agent"
|
||||||
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini"
|
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini"
|
||||||
|
|
||||||
# Loading common functions.
|
|
||||||
source /opt/kolla/kolla-common.sh
|
|
||||||
source /opt/kolla/config-sudoers.sh
|
|
||||||
|
|
||||||
# Override set_configs() here because it doesn't work for fat containers like
|
|
||||||
# this one.
|
|
||||||
set_configs() {
|
|
||||||
case $KOLLA_CONFIG_STRATEGY in
|
|
||||||
COPY_ALWAYS)
|
|
||||||
source /opt/kolla/neutron-dhcp-agent/config-external.sh
|
|
||||||
;;
|
|
||||||
COPY_ONCE)
|
|
||||||
if [[ -f /configured-dhcp ]]; then
|
|
||||||
echo 'INFO - Neutron-dhcp has already been configured; Refusing to copy new configs'
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
source /opt/kolla/neutron-dhcp-agent/config-external.sh
|
|
||||||
touch /configured-dhcp
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo '$KOLLA_CONFIG_STRATEGY is not set properly'
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# Execute config strategy
|
|
||||||
set_configs
|
|
||||||
|
|
||||||
exec $CMD $ARGS
|
exec $CMD $ARGS
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
SOURCES="/opt/kolla/neutron-agents/neutron.conf /opt/kolla/neutron-agents/l3_agent.ini /opt/kolla/neutron-agents/fwaas_driver.ini"
|
|
||||||
TARGET="/etc/neutron/"
|
|
||||||
OWNER="neutron"
|
|
||||||
|
|
||||||
for f in $SOURCES; do
|
|
||||||
if [[ -f "$f" ]]; then
|
|
||||||
fname=$(basename $f)
|
|
||||||
cp $f $TARGET
|
|
||||||
chown ${OWNER}: $TARGET/$fname
|
|
||||||
chmod 0644 $TARGET/$fname
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
SOURCE="/opt/kolla/neutron-agents/ml2_conf.ini"
|
|
||||||
TARGET="/etc/neutron/plugins/ml2/ml2_conf.ini"
|
|
||||||
OWNER="neutron"
|
|
||||||
|
|
||||||
if [[ -f "$SOURCE" ]]; then
|
|
||||||
cp $SOURCE $TARGET
|
|
||||||
chown ${OWNER}: $TARGET
|
|
||||||
chmod 0644 $TARGET
|
|
||||||
fi
|
|
@ -1,37 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
|
# Loading common functions.
|
||||||
|
source /opt/kolla/config-sudoers.sh
|
||||||
|
|
||||||
|
# Will be removed when this container is broken out into thin containers
|
||||||
CMD="/usr/bin/neutron-l3-agent"
|
CMD="/usr/bin/neutron-l3-agent"
|
||||||
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/fwaas_driver.ini --config-file /etc/neutron/plugins/ml2/ml2_conf.ini"
|
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/fwaas_driver.ini --config-file /etc/neutron/plugins/ml2/ml2_conf.ini"
|
||||||
|
|
||||||
# Loading common functions.
|
|
||||||
source /opt/kolla/kolla-common.sh
|
|
||||||
source /opt/kolla/config-sudoers.sh
|
|
||||||
|
|
||||||
# Override set_configs() here because it doesn't work for fat containers like
|
|
||||||
# this one.
|
|
||||||
set_configs() {
|
|
||||||
case $KOLLA_CONFIG_STRATEGY in
|
|
||||||
COPY_ALWAYS)
|
|
||||||
source /opt/kolla/neutron-l3-agent/config-external.sh
|
|
||||||
;;
|
|
||||||
COPY_ONCE)
|
|
||||||
if [[ -f /configured-l3 ]]; then
|
|
||||||
echo 'INFO - Neutron-l3 has already been configured; Refusing to copy new configs'
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
source /opt/kolla/neutron-l3-agent/config-external.sh
|
|
||||||
touch /configured-l3
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo '$KOLLA_CONFIG_STRATEGY is not set properly'
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# Execute config strategy
|
|
||||||
set_configs
|
|
||||||
|
|
||||||
exec $CMD $ARGS
|
exec $CMD $ARGS
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
SOURCES="/opt/kolla/neutron-agents/neutron.conf /opt/kolla/neutron-agents/metadata_agent.ini"
|
|
||||||
TARGET="/etc/neutron/"
|
|
||||||
OWNER="neutron"
|
|
||||||
|
|
||||||
for f in $SOURCES; do
|
|
||||||
if [[ -f "$f" ]]; then
|
|
||||||
fname=$(basename $f)
|
|
||||||
cp $f $TARGET
|
|
||||||
chown ${OWNER}: $TARGET/$fname
|
|
||||||
chmod 0644 $TARGET/$fname
|
|
||||||
fi
|
|
||||||
done
|
|
@ -1,37 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
|
# Loading common functions.
|
||||||
|
source /opt/kolla/config-sudoers.sh
|
||||||
|
|
||||||
|
# Will be removed when this container is broken out in thin containers
|
||||||
CMD="/usr/bin/neutron-metadata-agent"
|
CMD="/usr/bin/neutron-metadata-agent"
|
||||||
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini"
|
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini"
|
||||||
|
|
||||||
# Loading common functions.
|
|
||||||
source /opt/kolla/kolla-common.sh
|
|
||||||
source /opt/kolla/config-sudoers.sh
|
|
||||||
|
|
||||||
# Override set_configs() here because it doesn't work for fat containers like
|
|
||||||
# this one.
|
|
||||||
set_configs() {
|
|
||||||
case $KOLLA_CONFIG_STRATEGY in
|
|
||||||
COPY_ALWAYS)
|
|
||||||
source /opt/kolla/neutron-metadata-agent/config-external.sh
|
|
||||||
;;
|
|
||||||
COPY_ONCE)
|
|
||||||
if [[ -f /configured-md ]]; then
|
|
||||||
echo 'INFO - Neutron-metadata has already been configured; Refusing to copy new configs'
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
source /opt/kolla/neutron-metadata-agent/config-external.sh
|
|
||||||
touch /configured-md
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo '$KOLLA_CONFIG_STRATEGY is not set properly'
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# Execute config strategy
|
|
||||||
set_configs
|
|
||||||
|
|
||||||
exec $CMD $ARGS
|
exec $CMD $ARGS
|
||||||
|
7
docker/neutron/neutron-agents/start.sh
Executable file
7
docker/neutron/neutron-agents/start.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
|
# Loading common functions.
|
||||||
|
source /opt/kolla/kolla-common.sh
|
||||||
|
|
||||||
|
exec /usr/bin/supervisord
|
Loading…
Reference in New Issue
Block a user