updated to allow deployment to be driven by a configuration file
diff --git a/roles/head-node/files/compute-node.yml.j2 b/roles/head-node/files/compute-node.yml.j2
new file mode 100644
index 0000000..4a6a50d
--- /dev/null
+++ b/roles/head-node/files/compute-node.yml.j2
@@ -0,0 +1,4 @@
+- hosts: all
+ remote_user: ubuntu
+ roles:
+ - {{ provision.role }}
diff --git a/roles/head-node/tasks/main.yml b/roles/head-node/tasks/main.yml
index 3eb2785..a9f5e60 100644
--- a/roles/head-node/tasks/main.yml
+++ b/roles/head-node/tasks/main.yml
@@ -9,7 +9,7 @@
- name: Ensure Ansible Compute Config Files
become: yes
git:
- repo=http://gerrit.opencord.org/maas
+ repo={{ provision.location }}
dest=/tmp/ansible.maas
clone=yes
force=yes
@@ -17,20 +17,16 @@
- name: Ensure Ansible Roles Exist
become: yes
- command: cp -rf /tmp/ansible.maas/{{ item }} /etc/maas/ansible
- with_items:
- - roles
+ command: cp -rf /tmp/ansible.maas/{{ provision.role_path }} /etc/maas/ansible
- name: Ensure Ansible Roles Ownership
become: yes
- file: dest=/etc/maas/ansible/{{ item }} owner=maas group=maas recurse=yes
- with_items:
- - roles
+ file: dest=/etc/maas/ansible/{{ provision.role_path }} owner=maas group=maas recurse=yes
- name: Ensure Compute Node Playbook
become: yes
- copy:
- src=files/compute-node.yml
+ template:
+ src=files/compute-node.yml.j2
dest=/etc/maas/ansible/compute-node.yml
owner=maas
group=maas
diff --git a/roles/head-node/vars/main.yml b/roles/head-node/vars/main.yml
new file mode 100644
index 0000000..e97daf1
--- /dev/null
+++ b/roles/head-node/vars/main.yml
@@ -0,0 +1,9 @@
+provision:
+ # CHANGE:
+ # 'location' git URL from which to clone a repository that contains the role
+ # definitions to be used then provisioning a compute node
+ # 'role_path' directory path within the repo that contains the roles.
+ # 'role' name of the role to provision for new compute nodes
+ location: "{{ prov_location | default('http://gerrit.opencord.org/maas') }}"
+ role_path: "{{ prov_role_path | default('roles') }}"
+ role: "{{ prov_role | default('compute-node') }}"