diff --git a/ansible/all-in-one.yaml b/ansible/all-in-one.yaml index b9180c8a4072c9ff6d755a0491f143328da4944f..33bb47a2f7d92bf0b48e95c9758c19594ed991fe 100755 --- a/ansible/all-in-one.yaml +++ b/ansible/all-in-one.yaml @@ -1,43 +1,43 @@ -# - hosts: localhost -# vars_files: -# - host_vars/nectar.yaml -# gather_facts: true - -# roles: -# - role: openstack-common -# - role: openstack-volume -# - role: openstack-security-group -# - role: cluster-security-group -# - role: openstack-instance - -# - hosts: instances -# vars_files: -# - host_vars/docker.yaml -# gather_facts: true - -# roles: -# - role: openstack-proxy -# - role: all-dependencies -# - role: all-mount -# - role: all-docker - -# - hosts: dbs +- hosts: localhost + vars_files: + - host_vars/nectar.yaml + gather_facts: true + + roles: + - role: openstack-common + - role: openstack-volume + - role: openstack-security-group + - role: cluster-security-group + - role: openstack-instance + +- hosts: instances + vars_files: + - host_vars/docker.yaml + gather_facts: true + + roles: + - role: openstack-proxy + - role: all-dependencies + - role: all-mount + - role: all-docker + +- hosts: web + vars_files: + - host_vars/react.yaml + gather_facts: true + + roles: + - role: react-build + +- hosts: dbs -# roles: -# - role: cluster-build + roles: + - role: cluster-build - hosts: master roles: - role: slaves-cluster -# - hosts: web -# vars_files: -# - host_vars/react.yaml -# gather_facts: true - - # roles: - # - role: react-build - \ No newline at end of file diff --git a/ansible/host_vars/nectar.yaml b/ansible/host_vars/nectar.yaml index 42a72062b6fcafd73b9145ebc5bf4e9285debede..6824b82a68be4680851b86a32f67f2de9069ab73 100755 --- a/ansible/host_vars/nectar.yaml +++ b/ansible/host_vars/nectar.yaml @@ -24,7 +24,7 @@ security_groups: description: "Security group for HTTP" protocol: tcp port_range_min: 80 - port_range_max: 80 + port_range_max: 3000 remote_ip_prefix: 0.0.0.0/0 - name: couchDB-cluster4 description: "Security group for CouchDB cluster" @@ -67,10 +67,10 @@ instances: volumes: ['dbvolume3'] meta: group: slaves - # - name: web - # volumes: ['webvolume'] - # meta: - # group: web + - name: web + volumes: ['webvolume'] + meta: + group: web instance_image: 45225edb-66d8-4fd0-bf41-132a31a18166 instance_key_name: test-moh diff --git a/ansible/hosts b/ansible/hosts index 2df0052c1cc8a74891d63252fff639dd9fd67605..db1076077ce1eebc88443688db85f22b39696410 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -1,7 +1,6 @@ [web] [master] -172.26.129.221 ansible_host=172.26.129.221 [slaves] diff --git a/ansible/roles/react-build/defaults/main.yaml b/ansible/roles/react-build/defaults/main.yaml deleted file mode 100755 index 051c48b801f43c837e50cca1dd8818f7cef51bd6..0000000000000000000000000000000000000000 --- a/ansible/roles/react-build/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -react_dir: react-app \ No newline at end of file diff --git a/ansible/roles/react-build/tasks/main.yaml b/ansible/roles/react-build/tasks/main.yaml old mode 100755 new mode 100644 index 9b24b58e07fb63337a839a23f5c44566114af1cb..6dc7c71c4095c4ab339b538d5efa177410af45e7 --- a/ansible/roles/react-build/tasks/main.yaml +++ b/ansible/roles/react-build/tasks/main.yaml @@ -1,53 +1,23 @@ ---- -- name: Create React directory - tags: 'react-app' +- name: make sure the latest npm is installed + tags: 'node' become: yes - file: - path: "{{ react_dir }}" - owner: "{{ ansible_user }}" - group: "{{ ansible_user }}" - recurse: yes - state: directory + npm: + name: npm + global: yes + state: latest -- name: Configure compose - tags: 'react-app' +- name: install pm2 server + tags: 'pm2' become: yes - template: - src: docker-compose.yaml.j2 - dest: "{{ react_dir }}/docker-compose.yaml" - owner: "{{ ansible_user }}" - group: "{{ ansible_user }}" + npm: + name: pm2 + global: yes + state: latest -- name: Log into Dockerhub +- name: install react + tags: 'react' become: yes - docker_login: - username: matt01671 - password: comp90024 - -# - name: Configure ignore -# tags: 'react-app' -# become: yes -# template: -# src: .dockerignore -# dest: "{{ react_dir }}/.dockerignore" -# owner: "{{ ansible_user }}" -# group: "{{ ansible_user }}" - -# - name: Configure Dockerfile -# tags: 'react-app' -# become: yes -# template: -# src: Dockerfile -# dest: "{{ react_dir }}/Dockerfile" -# owner: "{{ ansible_user }}" -# group: "{{ ansible_user }}" - -- name: Run docker compose - tags: 'react-app' - become: yes - docker_compose: - project_src: "{{ react_dir }}" - pull: yes - state: present - remove_orphans: yes - recreate: always \ No newline at end of file + npm: + name: create-react-app + global: yes + state: present \ No newline at end of file diff --git a/ansible/roles/react-build/templates/docker-compose.yaml.j2 b/ansible/roles/react-build/templates/docker-compose.yaml.j2 deleted file mode 100755 index 27e82b4f26765ba651744783b2486cb61b2399c3..0000000000000000000000000000000000000000 --- a/ansible/roles/react-build/templates/docker-compose.yaml.j2 +++ /dev/null @@ -1,9 +0,0 @@ -version: '3.7' - -services: - - react_app: - image: matt01671/comp90024:1.0 - restart: always - ports: - - 8001:8000 \ No newline at end of file