interop-workloads/workloads/ansible/shade/dockerswarm/roles/prov_apply/tasks/main.yml

48 lines
1.4 KiB
YAML
Executable File

---
- name: Get public IP
set_fact: node_ip="{{ swarmnode.openstack.public_v4 }}"
when: swarmnode.openstack.public_v4 != ""
- name: Get public IP
set_fact: node_ip="{{ swarmnode.openstack.private_v4 }}"
when: swarmnode.openstack.public_v4 == ""
- name: Make certificate configuration file
copy:
src: "templates/openssl.cnf"
dest: "/tmp/{{ env }}/{{ node_ip }}/keys/"
- name: Make service file
template:
src: templates/dockerservice.j2
dest: "/tmp/{{ env }}/{{ node_ip }}/keys/dockerservice.cnf"
- name: Create bootstrap file
template:
src: templates/bootstrap1.j2
dest: "/tmp/{{ env }}/{{ node_ip }}/keys/bootstrap.sh"
when: swarmnode.openstack.private_v4 == ""
- name: Create bootstrap file
template:
src: templates/bootstrap2.j2
dest: "/tmp/{{ env }}/{{ node_ip }}/keys/bootstrap.sh"
when: swarmnode.openstack.private_v4 != ""
- name: Wait for ssh connection
wait_for:
host: "{{ node_ip }}"
port: 22
delay: 2
timeout: 300
search_regex: OpenSSH
- name: Transfer configureation
shell: scp -o "StrictHostKeyChecking=no" -r "/tmp/{{ env }}/{{ node_ip }}/keys" "core@{{ node_ip }}:/home/core"
- name: Transfer certificate file over to the nodes
shell: scp -o "StrictHostKeyChecking=no" -r "/tmp/{{ env }}/keys" "core@{{ node_ip }}:/home/core"
- name: Start services
shell: ssh "core@{{ node_ip }}" "sh keys/bootstrap.sh"