integrate the provisioner with automation for the automatic deployment
diff --git a/roles/compute-node/tasks/main.yml b/roles/compute-node/tasks/main.yml
index 8b4badd..ae8fb7b 100644
--- a/roles/compute-node/tasks/main.yml
+++ b/roles/compute-node/tasks/main.yml
@@ -65,10 +65,12 @@
- name: Verify Mellanox 40Gb NIC
shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c ConnectX-3 || true
register: mlx_nic_present
+ changed_when: False
- name: Verify Intel 40Gb NIC
shell: /usr/bin/lspci | grep "Ethernet controller" | grep -c "XL710 for 40GbE QSFP+" || true
register: intel_nic_present
+ changed_when: False
- name: Verify i40e Driver
command: modinfo --field=version i40e
diff --git a/roles/head-node/files/do-ansible b/roles/head-node/files/do-ansible
new file mode 100755
index 0000000..58e8fff
--- /dev/null
+++ b/roles/head-node/files/do-ansible
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+ID=$1
+HOSTNAME=$2
+IP=$3
+MAC=$4
+ROLE=$5
+
+echo "PROVISION $ID $HOSTNAME $IP $MAC $ROLE" >> /etc/maas/ansible/logs/$ID.log
+
+ANSIBLE_ROLES_PATH=/etc/maas/ansible/roles ansible-playbook --private-key=/etc/maas/ansible/id_rsa -i $IP, /etc/maas/ansible/compute-node.yml --skip-tags=interface_config >> /etc/maas/ansible/logs/$ID.out
diff --git a/roles/head-node/tasks/main.yml b/roles/head-node/tasks/main.yml
index a9f5e60..d084a67 100644
--- a/roles/head-node/tasks/main.yml
+++ b/roles/head-node/tasks/main.yml
@@ -23,6 +23,24 @@
become: yes
file: dest=/etc/maas/ansible/{{ provision.role_path }} owner=maas group=maas recurse=yes
+- name: Ensure Ansible Provisioning Script
+ become: yes
+ copy:
+ dest=/etc/maas/ansible/do-ansible
+ src=files/do-ansible
+ owner=maas
+ group=maas
+ mode=0755
+
+- name: Ensure Provisioning Log Directory
+ become: yes
+ file:
+ path=/etc/maas/ansible/logs
+ state=directory
+ owner=maas
+ group=maas
+ mode=0755
+
- name: Ensure Compute Node Playbook
become: yes
template:
diff --git a/roles/maas/tasks/main.yml b/roles/maas/tasks/main.yml
index 1452901..fc2d40b 100644
--- a/roles/maas/tasks/main.yml
+++ b/roles/maas/tasks/main.yml
@@ -20,14 +20,28 @@
become: yes
docker:
name: automation
- image: ciena/cord-maas-automation:0.1-prerelease
+ image: opencord/cord-maas-automation:latest
+ state: absent
+
+- name: Stop Provisioner Container
+ become: yes
+ docker:
+ name: provisioner
+ image: opencord/cord-provisioner:latest
state: absent
- name: Stop DHCP Harvester Container
become: yes
docker:
name: harvester
- image: ciena/cord-maas-dhcp-harvester:0.1-prerelease
+ image: opencord/cord-dhcp-harvester:latest
+ state: absent
+
+- name: Stop IP Allocator Container
+ become: yes
+ docker:
+ name: allocator
+ image: opencord/cord-ip-allocator:latest
state: absent
- name: MAAS Repository
@@ -173,11 +187,15 @@
- maas-clusterd
- maas-dhcpd
- bind9
+ tags:
+ - maas_restart
- name: Wait for MAAS to Intialize (start)
pause:
seconds=30
changed_when: false
+ tags:
+ - maas_restart
- name: MAAS Accepting API Requests
action: get_url url=http://{{ mgmt_ip_address.stdout }}/MAAS/api/1.0/maas/ dest=/tmp
@@ -189,7 +207,7 @@
- name: Configure MAAS
become: yes
- command: docker run ciena/cord-maas-bootstrap:0.1-prerelease --apikey='{{apikey.stdout}}' --sshkey='{{maas.user_sshkey}}' --url='http://{{mgmt_ip_address.stdout}}/MAAS/api/1.0' --network='{{networks.management}}' --interface='{{interfaces.management}}' --zone='administrative' --cluster='Cluster master' --domain='{{maas.domain}}' --bridge='{{networks.bridge_name}}' --bridge-subnet='{{networks.bridge}}'
+ command: docker run opencord/cord-maas-bootstrap:latest --apikey='{{apikey.stdout}}' --sshkey='{{maas.user_sshkey}}' --url='http://{{mgmt_ip_address.stdout}}/MAAS/api/1.0' --network='{{networks.management}}' --interface='{{interfaces.management}}' --zone='administrative' --cluster='Cluster master' --domain='{{maas.domain}}' --bridge='{{networks.bridge_name}}' --bridge-subnet='{{networks.bridge}}'
register: maas_config_result
changed_when: maas_config_result.stdout.find("CHANGED") != -1
failed_when: "'ERROR' in maas_config_result.stdout"
@@ -244,6 +262,26 @@
include: virtualbox.yml
when: virtualbox_support is defined
+- name: Ensure MAAS Ansible Config Directory
+ become: yes
+ file:
+ path=/etc/maas/ansible
+ owner=maas
+ group=maas
+ state=directory
+
+- name: Ensure SSH keys for Ansible
+ become: yes
+ command: cp /home/{{ ansible_user }}/.ssh/id_rsa /etc/maas/ansible/id_rsa
+
+- name: Ensure SSH Key Permissions
+ become: yes
+ file:
+ path: /etc/maas/ansible/id_rsa
+ owner: root
+ group: root
+ mode: 0400
+
- name: Custom Automation Compose Configurations
become: yes
template:
diff --git a/roles/maas/templates/automation-compose.yml.j2 b/roles/maas/templates/automation-compose.yml.j2
index 0e11776..7beb0c3 100644
--- a/roles/maas/templates/automation-compose.yml.j2
+++ b/roles/maas/templates/automation-compose.yml.j2
@@ -1,13 +1,32 @@
+provisioner:
+ image: opencord/cord-provisioner:latest
+ container_name: provisioner
+ labels:
+ - "lab.solution=CORD"
+ - "lab.component=provisioner"
+ environment:
+ # need to explicitly set the resolver, else go will skip the /etc/hosts file
+ - "GODEBUG=netdns=go"
+ - "PROVISION_PORT=4243"
+ - "PROVISION_LISTEN=0.0.0.0"
+ - "PROVISION_DEFAULT_ROLE=compute-node"
+ - "PROVISION_SCRIPT=/etc/maas/ansible/do-ansible"
+ volumes:
+ - "/etc/maas/ansible:/etc/maas/ansible"
+
automation:
- image: ciena/cord-maas-automation:0.1-prerelease
+ image: opencord/cord-maas-automation:latest
container_name: automation
labels:
- "lab.solution=CORD"
- "lab.component=automation"
- restart: always
+ links:
+ - provisioner
environment:
# need to explicitly set the resolver, else go will skip the /etc/hosts file
- "GODEBUG=netdns=go"
+ - "PROVISION_URL=http://provisioner:4243/provision/"
+ - "PROVISION_TTL=30m"
volumes:
- - ".:/mappings"
+ - "/etc/maas:/mappings"
command: [ "-apiVersion", "1.0", "-apikey", "{{ apikey.stdout }}", "-maas", "http://{{ mgmt_ip_address.stdout }}/MAAS", "-period", "30s", "-mappings", "@/mappings/mappings.json", "-always-rename" ]
diff --git a/roles/maas/templates/harvest-compose.yml.j2 b/roles/maas/templates/harvest-compose.yml.j2
index 6d9c25f..226c9e6 100644
--- a/roles/maas/templates/harvest-compose.yml.j2
+++ b/roles/maas/templates/harvest-compose.yml.j2
@@ -1,5 +1,5 @@
harvester:
- image: ciena/cord-maas-dhcp-harvester:0.1-prerelease
+ image: opencord/cord-dhcp-harvester:latest
container_name: harvester
restart: always
labels: