diff --git a/Makefile b/Makefile index 9c29c75..fdf1e86 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,12 @@ # vim: set noexpandtab: status: nova list up: ansible-playbook main.yml +test: + ansible-playbook test.yml + clean: ansible-playbook cleanup.yml diff --git a/README.md b/README.md index 86cb35a..3b244b2 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,44 @@ C4SCIENCE ========= * Ansible playbook for git infrastructure on openstack INSTALL ------- * You need ansible >= 2.0 ``` cd ~ git clone https://github.com/ansible/ansible.git cd ansible git submodule update --init --recursive sudo python setup.py install +sudo pip install shade +sudo apt-get install python-nova ``` USAGE ----- * How to use, ``` make status #list instances make up #create instances make clean #destroy instances ``` * You must create an Switch Engines bucket * see https://help.switch.ch/engines/documentation/s3-like-object-storage/ ``` ./s3cmd mb s3://phabricator ``` * you must create a volume for the repo, and attach it to the jump server ``` nova volume-create 100 nova volume-attach /dev/vdb ``` diff --git a/tasks/test-instances.yml b/tasks/test-instances.yml new file mode 100644 index 0000000..a940a87 --- /dev/null +++ b/tasks/test-instances.yml @@ -0,0 +1,58 @@ +--- +- name: Pause app01 + os_server_actions: + action: pause + auth: + auth_url: "{{ auth_url }}" + username: "{{ login_username }}" + password: "{{ login_password }}" + project_name: "{{ login_tenant_name }}" + server: c4science-app01 + timeout: 200 + +- name: Check HTTP connection + uri: url="http://{{ domain }}" + +- name: Check SSH connection + wait_for: host="{{ external_ip }}" port=22 + delegate_to: localhost + +- name: Unpause app01 + os_server_actions: + action: unpause + auth: + auth_url: "{{ auth_url }}" + username: "{{ login_username }}" + password: "{{ login_password }}" + project_name: "{{ login_tenant_name }}" + server: c4science-app01 + timeout: 200 + +- name: Pause app02 + os_server_actions: + action: pause + auth: + auth_url: "{{ auth_url }}" + username: "{{ login_username }}" + password: "{{ login_password }}" + project_name: "{{ login_tenant_name }}" + server: c4science-app02 + timeout: 200 + +- name: Check HTTP connection + uri: url=http://{{ domain }} + +- name: Check SSH connection + wait_for: host={{ external_ip }} port=22 + delegate_to: localhost + +- name: Unpause app02 + os_server_actions: + action: unpause + auth: + auth_url: "{{ auth_url }}" + username: "{{ login_username }}" + password: "{{ login_password }}" + project_name: "{{ login_tenant_name }}" + server: c4science-app02 + timeout: 200 diff --git a/test.yml b/test.yml new file mode 100644 index 0000000..38e0169 --- /dev/null +++ b/test.yml @@ -0,0 +1,9 @@ +--- +- name: Test Instances + hosts: 127.0.0.1 + connection: local + gather_facts: false + vars_files: + - "vars/main.yml" + tasks: + - include: tasks/test-instances.yml