Skip to content
Snippets Groups Projects
Commit edff62ed authored by Mike Marsh's avatar Mike Marsh
Browse files

more removal of code

parent 9213feac
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 324 deletions
---
- name: Pull the latest version of the grey builder image
command: docker pull {{grey_builder_image}}
when: not detached
- name: Generate the listening post Dockerfile
template: src=Dockerfile.lp.j2
dest=./runtime_support/listening_post/Dockerfile
- name: Generate the vantage node Dockerfile
template: src=Dockerfile.vn.j2
dest=./runtime_support/vantage_node/Dockerfile
- name: Spin up the grey builder
docker: image={{grey_builder_image}}
name=gb
password=px
volumes={{work_dir}}/extsrc/runtime:/runtime
register: grey_builder_info
- set_fact:
gb_ip: "{{grey_builder_info.ansible_facts.docker_containers[0].NetworkSettings.IPAddress}}"
- name: Set up the provisioning on the grey builder
add_host: name={{gb_ip}}
groups=grey_builder
- name: Wait for the grey builder to be ready
wait_for: port=22
host={{gb_ip}}
- name: Trigger the next step
add_host: name=localhost
groups=g_mission_elements_config
FROM {{grey_builder_image}}
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python-pip libsnappy-dev python-dev python-msgpack
ADD http://ns1.px.ftw/~mmarsh/ca-cert.crt /usr/local/share/ca-certificates/ca-cert.crt
RUN update-ca-certificates
ADD pip.conf /.pip/pip.conf
ADD runtime/ /opt/runtime
ADD invoke /opt/runtime/invoke
ADD bouncer /opt/bouncer/bouncer
ADD lp.conf /etc/supervisor/conf.d/lp.conf
CMD ["/usr/bin/supervisord"]
FROM {{grey_builder_image}}
ADD runtime/ /opt/runtime
ADD invoke /opt/runtime/invoke
ADD bouncer /opt/bouncer/bouncer
{{"ADD vn.conf /etc/supervisor/conf.d/vn.conf" if not deployer else ""}}
ADD authorized_keys /root/.ssh/authorized_keys
ADD planx_key /root/.ssh/id_rsa
RUN chmod 644 /root/.ssh/authorized_keys
RUN chmod 600 /root/.ssh/id_rsa
CMD ["/usr/bin/supervisord"]
---
- name: Clone the BlueController locally, so we can cross-mount it to docker images
git: dest=extsrc/BlueController
repo={{controller_repo}}
version={{controller_version}}
update={{git_update}}
- name: Clone playbook
git: dest=extsrc/playbook
repo={{playbook_repo}}
version={{playbook_version}}
update={{git_update}}
- name: Cache BlueController and its dependencies
shell: pip2tgz {{work_dir}}/extsrc/pipcache . chdir=extsrc/BlueController
when: not detached
- name: Cache deployer and its dependencies
shell: pip2tgz {{work_dir}}/extsrc/pipcache deployer
when: deployer and not detached
- name: Index the pip cache
shell: dir2pi . chdir=extsrc/pipcache
# Configure parameters.py
- name: Set the runtime proxy IP address
lineinfile: state=present
dest=extsrc/BlueController/bluecontroller/service/parameters.py
regexp="^RuntimeProxyIp"
line="RuntimeProxyIp = \"{{rt_config.lp_ip}}\""
- name: Set the BlueController UUID
lineinfile: state=present
dest=extsrc/BlueController/bluecontroller/service/parameters.py
regexp="^uuid\s*="
line="uuid = \"{{rt_config.pm_uuid}}\""
- name: Disable ATMOS
lineinfile: state=present
dest=extsrc/BlueController/bluecontroller/service/parameters.py
regexp="^UseAtmos"
line="UseAtmos = False"
- name: Make a list of proxy UUIDs
set_fact:
proxyUUIDs: "{{grey_proxy_routing.nodes|map(attribute='uuid')|list}}"
- name: Make a list of node UUIDs
set_fact:
nodeUUIDs: "{{grey_routing.nodes|map(attribute='uuid')|list}}"
- name: Concatenate the UUID lists
set_fact:
tempNodeList: "{{(proxyUUIDs+nodeUUIDs)|to_json}}"
- name: Set the node list
lineinfile: state=present
dest=extsrc/BlueController/bluecontroller/service/parameters.py
regexp="^TempNodeList ="
line="TempNodeList = {{tempNodeList}}"
# Configure the luna connection
- name: Set the luna hostname
template: dest=plan/pxluna_configs_mte.py
src=pxluna.configs.mte.j2
# Download and unpack NSQ
- name: Download the NSQ tarball
get_url: url={{nsq_uri}}
dest=extsrc/nsq.tgz
- name: Unpack the NSQ tarball
unarchive: src=extsrc/nsq.tgz
dest={{work_dir}}/extsrc/
---
- include: testbed_code_checkout.yml
---
- name: Copy over the relevant plans
copy: src={{item.directory}}/
dest=plan/{{item.id}}
with_items: missions
---
# Runtime parameters
- name: Generate family UUID
command: uuidgen
register: family_uuid
- name: Generate plan master UUID
command: uuidgen
register: pm_uuid
- set_fact:
listening_post: "{{grey_proxy_routing.nodes[0]}}"
- set_fact:
rt_config:
lp_uuid: "{{listening_post.uuid}}"
lp_ip: "{{listening_post.address}}"
lp_port: 8889
pm_uuid: "{{pm_uuid.stdout}}"
pm_ip: "{{plan_master_ip}}"
pm_port: 8888
family: "{{family_uuid.stdout}}"
- name: Clone the runtime locally, so we can cross-mount it to docker images
git: dest=extsrc/runtime
repo={{runtime_repo}}
version={{runtime_version}}
update={{git_update}}
- name: Set the LP IP address in runtime.py
lineinfile: state=present
dest=extsrc/runtime/py/runtime_common/runtime.py
regexp="^ServerIp\s*="
line="ServerIp = '{{rt_config.lp_ip}}'"
- name: Set the LP port in runtime.py (current mis-spelled version)
lineinfile: state=present
dest=extsrc/runtime/py/runtime_common/runtime.py
regexp="^SeverPort\s*="
line="SeverPort = '{{rt_config.lp_port}}'"
- name: Set the LP port in runtime.py
lineinfile: state=present
dest=extsrc/runtime/py/runtime_common/runtime.py
regexp="^ServerPort\s*="
line="ServerPort = '{{rt_config.lp_port}}'"
---
- include: mission_checkout.yml
- include: runtime_config.yml
- include: BlueController_config.yml
- name: Trigger the next step
add_host: name=localhost
groups=g_blue_config
LUNA_HOSTNAME = "{{luna_ip}}"
---
- include: testbed_mission_elements_config.yml
---
- set_fact:
lp_image_name: lp_image
- set_fact:
vn_image_name: vn_image
- name: Change the ownership of the built runtime
command: chown -R {{user}} --from=root extsrc/runtime
- name: Copy the runtime into the listening post
command: rsync -a extsrc/runtime runtime_support/listening_post
- name: Copy the runtime into the vantage node
command: rsync -a extsrc/runtime runtime_support/vantage_node
- name: Create the LP image
docker_image: name={{lp_image_name}}
path=runtime_support/listening_post
state=build
nocache=true
- name: Create the VN image
docker_image: name={{vn_image_name}}
path=runtime_support/vantage_node
state=build
nocache=true
- name: Bring down the grey builder
docker: image=docker.px.net/px_controller/grey_builder
name=gb
state=absent
when: not keep_builder
- name: Add the proxy gateways
add_host: name={{item.name}}
ansible_connection=local
gateway="{{item}}"
groups=gateways
sshd_image={{sshd_image}}
work_dir={{work_dir}}
collect=grey_proxy_gateway
capture_bridges={{capture_bridges}}
with_items: grey_proxy_routing.gateways
- name: Add the vantage node gateways
add_host: name={{item.name}}
ansible_connection=local
groups=gateways
gateway="{{item}}"
sshd_image={{sshd_image}}
work_dir={{work_dir}}
collect=grey_gateway
capture_bridges={{capture_bridges}}
with_items: grey_routing.gateways
- name: Add the proxies
add_host: name={{item.name}}
ansible_connection=local
groups=networked_nodes
node="{{item}}"
collect=grey_proxy
image={{lp_image_name}}
work_dir={{work_dir}}
pip_cachedir={{pip_cachedir}}
docker_command='/opt/runtime/invoke {{rt_config.lp_uuid}} {{rt_config.family}} {{rt_config.lp_uuid}} {{rt_config.lp_ip}} {{rt_config.lp_port}} {{rt_config.pm_uuid}} {{rt_config.lp_ip}} {{rt_config.pm_port}}'
with_items: grey_proxy_routing.nodes
- name: Add the vantage nodes
add_host: name={{item.name}}
ansible_connection=local
groups=networked_nodes
node="{{item}}"
collect=grey
image={{vn_image_name}}
work_dir={{work_dir}}
pip_cachedir={{pip_cachedir}}
docker_command='/opt/runtime/invoke {{item.uuid}} {{rt_config.family}} {{rt_config.pm_uuid}} {{rt_config.lp_ip}} {{rt_config.lp_port}}'
with_items: grey_routing.nodes
- name: Pull the latest version of the other needed images
command: docker pull {{item.image|default(sshd_image)}}
with_items: red_routing.nodes
when: ((not detached) and (red_routing is defined))
- name: Add the red node gateways
add_host: name={{item.name}}
ansible_connection=local
groups=gateways
gateway="{{item}}"
sshd_image={{sshd_image}}
work_dir={{work_dir}}
collect=red_gateway
capture_bridges={{capture_bridges}}
with_items: red_routing.gateways
when: red_routing.gateways is defined
- name: Add the red nodes
add_host: name={{item.name}}
ansible_connection=local
groups=networked_nodes
node="{{item}}"
collect=red
work_dir={{work_dir}}
pip_cachedir={{pip_cachedir}}
image={{vn_image_name}}
docker_command={{item.command|default("/usr/bin/supervisord")}}
with_items: red_routing.nodes
when: red_routing.nodes is defined
- name: Trigger the next step
add_host: name=localhost
groups=g_wire_networks_together,g_store_output
- name: Add the plan master for running stuff
add_host: name={{plan_master_docker_ip}}
groups=plan_masters
addr={{plan_master_docker_ip}}
mission_id={{mission_id}}
controller_dir={{controller_dir}}
plan_dir={{plan_dir}}
runtime_dir={{runtime_dir}}
nsq_uri={{nsq_uri}}
nsq_dir={{nsq_dir}}
pip_args="{{pip_args}}"
deployer={{deployer}}
reinstall_runtime={{reinstall_runtime}}
- name: Load the topology into the core and run the missions
add_host: name={{plan_master_docker_ip}}
groups=g_load_topology,g_run_plan
addr={{plan_master_docker_ip}}
plan_dir={{plan_dir}}
controller_dir={{controller_dir}}
missions="{{missions}}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment