summaryrefslogtreecommitdiffstats
path: root/cyborg_enhancement/mitaka_version/cyborg/setup
diff options
context:
space:
mode:
authorbobzhou <zhoubo8@lenovo.com>2018-12-17 17:41:39 +0800
committerbobzhou <zhoubo8@lenovo.com>2018-12-17 17:41:39 +0800
commit31560e9a26e6a7e2e65d18924c938ee7a7683fb3 (patch)
tree26ec12331a2ec612a0f51c7866fbe41262ca0fe1 /cyborg_enhancement/mitaka_version/cyborg/setup
parentfc1b7908a77b5cce763f92b3d314057345f3ab7a (diff)
upload cyborg base mitaka version
Change-Id: Iff52024026c9eff899246be70cc89fe6e65befff Signed-off-by: bobzhou <zhoubo8@lenovo.com>
Diffstat (limited to 'cyborg_enhancement/mitaka_version/cyborg/setup')
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/deploy-cyborg.yml22
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_agent/tasks/main.yml22
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_agent/templates/openstack-cyborg-agent.service.j213
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_api/tasks/main.yml22
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_api/templates/openstack-cyborg-api.service.j213
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_conductor/tasks/main.yml22
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_conductor/templates/openstack-cyborg-conductor.service.j213
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/generate_credentials/tasks/main.yml20
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/install_package/tasks/main.yml38
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/template_config/tasks/main.yml13
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/template_config/templates/cyborg.conf.j23
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_agent/tasks/main.yml13
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_api/tasks/main.yml21
-rw-r--r--cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_conductor/tasks/main.yml13
14 files changed, 248 insertions, 0 deletions
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/deploy-cyborg.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/deploy-cyborg.yml
new file mode 100644
index 0000000..71bde2e
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/deploy-cyborg.yml
@@ -0,0 +1,22 @@
+---
+# This Ansible playbook deploys Cyborg services on an openstack cloud
+
+- hosts: controller
+ remote_user: heat-admin
+ roles:
+ - generate_credentials
+ - install_package
+ - template_config
+ - deploy_api
+ - deploy_conductor
+ - validate_api
+ - validate_conductor
+
+- hosts: compute
+ remote_user: heat-admin
+ roles:
+ - install_package
+ - template_config
+ - deploy_agent
+ - validate_agent
+ #- deploy_drivers
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_agent/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_agent/tasks/main.yml
new file mode 100644
index 0000000..6a3899d
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_agent/tasks/main.yml
@@ -0,0 +1,22 @@
+---
+# Sets up Cyborg api to start at boot
+
+- name: Create Cyborg user
+ user:
+ name: cyborg
+ comment: "cyborg user"
+ createhome: no
+ become: true
+
+- name: Template service file for Cyborg Agent
+ template:
+ src: openstack-cyborg-agent.service.j2
+ dest: /usr/lib/systemd/system/openstack-cyborg-agent.service
+ become: true
+
+- name: Start service and set to run at boot
+ service:
+ name: openstack-cyborg-agent
+ state: started
+ enabled: yes
+ become: true
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_agent/templates/openstack-cyborg-agent.service.j2 b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_agent/templates/openstack-cyborg-agent.service.j2
new file mode 100644
index 0000000..676beff
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_agent/templates/openstack-cyborg-agent.service.j2
@@ -0,0 +1,13 @@
+[Unit]
+Description=OpenStack Accelerator management service
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=cyborg
+ExecStart=/usr/bin/cyborg-agent
+PrivateTmp=true
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_api/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_api/tasks/main.yml
new file mode 100644
index 0000000..6c3922a
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_api/tasks/main.yml
@@ -0,0 +1,22 @@
+---
+# Sets up Cyborg api to start at boot
+
+- name: Create Cyborg user
+ user:
+ name: cyborg
+ comment: "cyborg user"
+ createhome: no
+ become: true
+
+- name: Template service file for Cyborg API
+ template:
+ src: openstack-cyborg-api.service.j2
+ dest: /usr/lib/systemd/system/openstack-cyborg-api.service
+ become: true
+
+- name: Start service and set to run at boot
+ service:
+ name: openstack-cyborg-api
+ state: started
+ enabled: yes
+ become: true
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_api/templates/openstack-cyborg-api.service.j2 b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_api/templates/openstack-cyborg-api.service.j2
new file mode 100644
index 0000000..8d40ec8
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_api/templates/openstack-cyborg-api.service.j2
@@ -0,0 +1,13 @@
+[Unit]
+Description=OpenStack Accelerator management service
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=cyborg
+ExecStart=/usr/bin/cyborg-api
+PrivateTmp=true
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_conductor/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_conductor/tasks/main.yml
new file mode 100644
index 0000000..d5c41d1
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_conductor/tasks/main.yml
@@ -0,0 +1,22 @@
+---
+# Sets up Cyborg api to start at boot
+
+- name: Create Cyborg user
+ user:
+ name: cyborg
+ comment: "cyborg user"
+ createhome: no
+ become: true
+
+- name: Template service file for Cyborg Conductor
+ template:
+ src: openstack-cyborg-conductor.service.j2
+ dest: /usr/lib/systemd/system/openstack-cyborg-conductor.service
+ become: true
+
+- name: Start service and set to run at boot
+ service:
+ name: openstack-cyborg-conductor
+ state: started
+ enabled: yes
+ become: true
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_conductor/templates/openstack-cyborg-conductor.service.j2 b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_conductor/templates/openstack-cyborg-conductor.service.j2
new file mode 100644
index 0000000..10b5ced
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/deploy_conductor/templates/openstack-cyborg-conductor.service.j2
@@ -0,0 +1,13 @@
+[Unit]
+Description=OpenStack Accelerator management service
+After=syslog.target network.target
+
+[Service]
+Type=simple
+User=glance
+ExecStart=/usr/bin/cyborg-conductor
+PrivateTmp=true
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/generate_credentials/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/generate_credentials/tasks/main.yml
new file mode 100644
index 0000000..55e8b44
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/generate_credentials/tasks/main.yml
@@ -0,0 +1,20 @@
+---
+
+- name: Create Cyborg mysql user
+ mysql_user:
+ name: cyborg
+ password: "{{ lookup('password', 'credentials/cyborg/mysqlpassword length=15') }}" # Generates a password
+ priv: '*.*:ALL,GRANT' # Do we only need the cyborg database?
+ state: present
+ become: true
+
+- name: Create Cyborg rabbitmq user
+ rabbitmq_user:
+ user: cyborg
+ password: "{{ lookup('password', 'credentials/cyborg/rabbitpassword length=15') }}" # Generates a password
+ vhost: /
+ read_priv: .*
+ write_priv: .*
+ configure_priv: .*
+ state: present
+ become: true
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/install_package/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/install_package/tasks/main.yml
new file mode 100644
index 0000000..561cc1c
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/install_package/tasks/main.yml
@@ -0,0 +1,38 @@
+---
+
+- name: Check if pip is installed
+ shell: "which pip"
+ register: which_pip
+ ignore_errors: true
+
+- name: Install pip
+ package:
+ name: python-pip
+ state: present
+ when: which_pip|failed
+ become: true
+
+- name: Install rsync
+ package:
+ name: rsync
+ state: present
+ become: true
+
+- name: Copy cyborg to host
+ synchronize:
+ src: ../../../cyborg/
+ dest: /tmp/cyborg
+ use_ssh_args: yes
+
+- name: Remove old Cyborg if installed
+ pip:
+ name: cyborg
+ state: absent
+ become: true
+ ignore_errors: true
+
+- name: Install Cyborg using pip
+ pip:
+ name: /tmp/cyborg
+ state: present
+ become: true
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/template_config/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/template_config/tasks/main.yml
new file mode 100644
index 0000000..040f3e2
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/template_config/tasks/main.yml
@@ -0,0 +1,13 @@
+---
+
+- name: Create cyborg config dir
+ file:
+ path: /etc/cyborg
+ state: directory
+ become: true
+
+- name: Template Cyborg.conf
+ template:
+ src: cyborg.conf.j2
+ dest: /etc/cyborg/cyborg.conf
+ become: true
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/template_config/templates/cyborg.conf.j2 b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/template_config/templates/cyborg.conf.j2
new file mode 100644
index 0000000..1298560
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/template_config/templates/cyborg.conf.j2
@@ -0,0 +1,3 @@
+[DEFAULT]
+connection=mysql+pymysql://cyborg:{{ lookup('password', 'credentials/cyborg/rabbitpassword length=15') }}@overcloud-controller-0.internalapi/nova?read_default_file=/etc/my.cnf.d/tripleo.cnf&read_default_group=tripleo
+transport_url=rabbit://cyborg:{{ lookup('password', 'credentials/cyborg/rabbitpassword length=15') }}@overcloud-controller-0.internalapi:5672/?ssl=0
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_agent/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_agent/tasks/main.yml
new file mode 100644
index 0000000..8d86faa
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_agent/tasks/main.yml
@@ -0,0 +1,13 @@
+---
+
+- name: Check Agent status
+ service:
+ name: openstack-cyborg-agent
+ state: started
+ enabled: yes
+ become: true
+ register: result
+
+- name: Fail if Agent is not up
+ fail: msg="Cyborg Agent did not start correctly!"
+ when: result.status.ActiveState == "failed"
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_api/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_api/tasks/main.yml
new file mode 100644
index 0000000..c3188ed
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_api/tasks/main.yml
@@ -0,0 +1,21 @@
+---
+
+- name: Check API status
+ service:
+ name: openstack-cyborg-api
+ state: started
+ enabled: yes
+ become: true
+ register: result
+
+- name: Fail if API did not start
+ fail: msg="Cyborg API did not start correctly!"
+ when: result.status.ActiveState == "failed"
+
+- name: Make a request to the cyborg API endpoint
+ wait_for:
+ host: localhost
+ port: 6666
+ state: started
+ delay: 1
+ timeout: 60
diff --git a/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_conductor/tasks/main.yml b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_conductor/tasks/main.yml
new file mode 100644
index 0000000..b36008f
--- /dev/null
+++ b/cyborg_enhancement/mitaka_version/cyborg/setup/roles/validate_conductor/tasks/main.yml
@@ -0,0 +1,13 @@
+---
+
+- name: Check if Conductor is running
+ service:
+ name: openstack-cyborg-conductor
+ state: started
+ enabled: yes
+ become: true
+ register: result
+
+- name: Fail if Conductor is not running
+ fail: msg="Cyborg Conductor did not start correctly!"
+ when: result.status.ActiveState == "failed"