Skip to content

Commit

Permalink
Opsexp 570 (#26)
Browse files Browse the repository at this point in the history
* change path

* typo

* change details

* add check to single test

* try again

* undo test for 8880

* and again

* try again

* try again

* typo

* output nginx

* change order debug

* next

* again

* and again

* lint

* try remove double reload

* horro

* and again

* lint

* and one more

* disable selinux

* :/

* ?

* and again

* final countdown

* what about now?

Co-authored-by: Lucian Suciu <[email protected]>
  • Loading branch information
lsuciu and Lucian Suciu authored Oct 9, 2020
1 parent 9b279de commit 60b715d
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 24 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ skip_list:
- '204'
- '208'
- '301'
- '303'
- '305'
- '306'
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
- ssh ec2-user@$control_machine_ip "source ~/.bash_profile;pip install --upgrade awscli 'molecule-ec2';"
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;molecule destroy -s ec2"
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;molecule create -s ec2"
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;ansible-playbook playbooks/acs.yml -i /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_BUILD_NUMBER/alfresco-ansible-deployment/molecule_temp_dir/inventory/ansible_inventory.yml"
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;sudo setenforce 0; ansible-playbook playbooks/acs.yml -i /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_BUILD_NUMBER/alfresco-ansible-deployment/molecule_temp_dir/inventory/ansible_inventory.yml"
- echo "wait for repo to be up" && sleep 5m
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;molecule verify -s ec2"
- export TESTHOST=$(ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;cat molecule_temp_dir/instance_config.yml | yq .[].address -r")
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/test_acs.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_adw_is_accesible(host, AnsibleVars):
output = None
command = False
while not command or time.time() < timeout:
run_command = host.run("curl -v -k --connect-timeout 5 http://{}/".format(AnsibleVars['repo_host']))
run_command = host.run("curl -v -k --connect-timeout 5 http://{}/digital-workspace/".format(AnsibleVars['repo_host']))
command = run_command.succeeded
output = run_command.stdout
assert_that(output,contains_string("Alfresco Digital Workspace"))
Expand Down
3 changes: 2 additions & 1 deletion molecule/ec2/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ driver:

platforms:
- name: "molecule_${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}"
image: ami-0affd4508a5d2481b
# image: ami-0affd4508a5d2481b
image: ami-0667c462e50c0e905
instance_type: t2.xlarge
region: us-east-1
vpc_subnet_id: subnet-06ffe524598660d99
Expand Down
2 changes: 1 addition & 1 deletion playbooks/acs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
- role: '../roles/search'
- role: '../roles/transformers'
tags:
- search
- search
12 changes: 7 additions & 5 deletions roles/adw/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
# handlers file for adw
- name: restart nginx
service: name=nginx state=restarted

- name: validate nginx configuration
command: nginx -t -c /etc/nginx/nginx.conf
changed_when: false

- name: reload nginx
service: name=nginx state=reloaded
service: name=nginx state=reloaded
become: true
become_user: root
- name: restart nginx
service: name=nginx state=restarted
become: true
become_user: root
17 changes: 12 additions & 5 deletions roles/adw/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
# tasks file for adw
- import_tasks: nginx.yml

- name: check if "{{ nginx_folder }}/alfresco-digital-workspace-{{ adwVersion }}.zip" file exists
- name: check if "{{ temp_dir }}/alfresco-digital-workspace-{{ adwVersion }}.zip" file exists
stat:
path: "{{ temp_dir }}/alfresco-digital-workspace-{{ adwVersion }}.zip"
register: adw_zip
Expand All @@ -14,6 +12,13 @@
mode: '0755'
when: not adw_zip.stat.exists

- name: Create "{{ nginx_folder }}/digital-workspace/" dir
file:
path: "{{ nginx_folder }}/digital-workspace/"
state: directory
mode: '0755'
when: not adw_zip.stat.exists

- name: Download alfresco-digital-workspace-{{ adwVersion }}.zip
get_url:
url: "{{ adw_tgz_url }}"
Expand All @@ -30,6 +35,8 @@
become: yes
unarchive:
src: "{{ temp_dir }}/alfresco-digital-workspace-{{ adwVersion }}.zip"
dest: "{{ nginx_folder }}/"
dest: "{{ nginx_folder }}/digital-workspace/"
remote_src: yes
creates: "{{ nginx_folder }}/app.config.json"
creates: "{{ nginx_folder }}/digital-workspace/app.config.json"

- include_tasks: nginx.yml
19 changes: 12 additions & 7 deletions roles/adw/tasks/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@
file:
path: "{{ nginx_vhost_path }}"
state: directory
notify: reload nginx

- name: Remove legacy vhosts.conf file.
file:
path: "{{ nginx_vhost_path }}/vhosts.conf"
state: absent

- name: Ensure nginx service is running as configured.
service:
name: nginx
state: started
enabled: true
notify: restart nginx

- name: Add managed vhost config files.
template:
Expand All @@ -26,10 +37,4 @@
owner: root
group: root
mode: 0644
notify: reload nginx

- name: Remove legacy vhosts.conf file.
file:
path: "{{ nginx_vhost_path }}/vhosts.conf"
state: absent
notify: reload nginx
3 changes: 1 addition & 2 deletions roles/adw/templates/alfresco_adw.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
server {

listen 8880;

client_max_body_size 0;
Expand All @@ -9,7 +8,7 @@ server {
proxy_pass_header Set-Cookie;

location / {
root {{ nginx_folder }};
root {{ nginx_folder }}/digital-workspace/;
index index.html index.htm;
}
}
2 changes: 1 addition & 1 deletion roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@
group: "{{ group_name }}"
recurse: yes
mode: 'u=rwx,g=rwx,o=rx'
when: not logs_exists.stat.exists
when: not logs_exists.stat.exists
4 changes: 4 additions & 0 deletions roles/nginx/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
# handlers file for nginx
- name: restart nginx
service: name=nginx state=restarted
become: true
become_user: root

- name: validate nginx configuration
command: nginx -t -c /etc/nginx/nginx.conf
changed_when: false

- name: reload nginx
service: name=nginx state=reloaded
become: true
become_user: root

0 comments on commit 60b715d

Please sign in to comment.