summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/backup_nova_conf/tasks/main.yaml18
-rw-r--r--ansible/roles/create_flavor/tasks/main.yaml16
-rw-r--r--ansible/roles/delete_flavor/tasks/main.yaml13
-rw-r--r--ansible/roles/recover_nova_conf/tasks/main.yaml18
-rw-r--r--ansible/roles/restart_nova_service/tasks/main.yaml23
-rw-r--r--ansible/roles/set_flavor_property/tasks/main.yaml14
-rw-r--r--ansible/roles/set_nova_conf/tasks/main.yaml17
7 files changed, 119 insertions, 0 deletions
diff --git a/ansible/roles/backup_nova_conf/tasks/main.yaml b/ansible/roles/backup_nova_conf/tasks/main.yaml
new file mode 100644
index 000000000..ca95bac59
--- /dev/null
+++ b/ansible/roles/backup_nova_conf/tasks/main.yaml
@@ -0,0 +1,18 @@
+---
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- name: backup nova.conf file
+ copy:
+ src: /etc/nova/nova.conf
+ dest: /tmp/nova.conf
+ owner: nova
+ group: nova
+ remote_src: True
+ become: true
diff --git a/ansible/roles/create_flavor/tasks/main.yaml b/ansible/roles/create_flavor/tasks/main.yaml
new file mode 100644
index 000000000..9b776c694
--- /dev/null
+++ b/ansible/roles/create_flavor/tasks/main.yaml
@@ -0,0 +1,16 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+- name: create flavor {{ flavor }}
+ os_nova_flavor:
+ cloud: opnfv
+ state: present
+ name: "{{ flavor }}"
+ ram: "{{ ram }}"
+ vcpus: "{{ vcpus }}"
+ disk: "{{ disk }}"
diff --git a/ansible/roles/delete_flavor/tasks/main.yaml b/ansible/roles/delete_flavor/tasks/main.yaml
new file mode 100644
index 000000000..dc9fc88ce
--- /dev/null
+++ b/ansible/roles/delete_flavor/tasks/main.yaml
@@ -0,0 +1,13 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+- name: delete flavor {{ flavor }}
+ os_nova_flavor:
+ cloud: opnfv
+ state: absent
+ name: "{{ flavor }}"
diff --git a/ansible/roles/recover_nova_conf/tasks/main.yaml b/ansible/roles/recover_nova_conf/tasks/main.yaml
new file mode 100644
index 000000000..44919d2ae
--- /dev/null
+++ b/ansible/roles/recover_nova_conf/tasks/main.yaml
@@ -0,0 +1,18 @@
+---
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- name: recover nova.conf file
+ copy:
+ src: /tmp/nova.conf
+ dest: /etc/nova/nova.conf
+ owner: nova
+ group: nova
+ remote_src: True
+ become: true
diff --git a/ansible/roles/restart_nova_service/tasks/main.yaml b/ansible/roles/restart_nova_service/tasks/main.yaml
new file mode 100644
index 000000000..2bdce652d
--- /dev/null
+++ b/ansible/roles/restart_nova_service/tasks/main.yaml
@@ -0,0 +1,23 @@
+---
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- name: restart "{{ service }}" service
+ service:
+ name: "{{ service }}"
+ state: restarted
+ become: true
+ when: ansible_os_family == "Debian"
+
+- name: restart "openstack-{{ service }}" service
+ service:
+ name: "openstack-{{ service }}"
+ state: restarted
+ become: true
+ when: ansible_os_family == "RedHat"
diff --git a/ansible/roles/set_flavor_property/tasks/main.yaml b/ansible/roles/set_flavor_property/tasks/main.yaml
new file mode 100644
index 000000000..f98988783
--- /dev/null
+++ b/ansible/roles/set_flavor_property/tasks/main.yaml
@@ -0,0 +1,14 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+- name: set flavor "{{ flavor }}" property {{ key }} = {{ value }}
+ shell:
+ source /etc/yardstick/openstack.creds;
+ openstack flavor set --property {{ key }}={{ value }} {{ flavor }};
+ args:
+ executable: /bin/bash
diff --git a/ansible/roles/set_nova_conf/tasks/main.yaml b/ansible/roles/set_nova_conf/tasks/main.yaml
new file mode 100644
index 000000000..ae665c5d0
--- /dev/null
+++ b/ansible/roles/set_nova_conf/tasks/main.yaml
@@ -0,0 +1,17 @@
+---
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+- name: set "{{ key }}" value
+ ini_file:
+ dest: /etc/nova/nova.conf
+ section: "{{ section }}"
+ option: "{{ key }}"
+ value: "{{ value }}"
+ become: true