This repository was archived by the owner on Jul 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Add integration test playbook. #4
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
| LOAD_BALANCER_SERVER_IP: "{{ lookup('dig', ansible_host) }}" | ||
|
|
||
| LOAD_BALANCER_OPS_EMAIL: [email protected] | ||
|
|
||
| LOAD_BALANCER_APT_PACKAGES: | ||
| - haproxy | ||
| - letsencrypt | ||
| - inotify-tools | ||
| - python3-openssl | ||
| - socat | ||
| - ssl-cert | ||
|
|
||
| LOAD_BALANCER_CERTS_DIR: /etc/haproxy/certs | ||
| LOAD_BALANCER_CONF_DIR: /etc/haproxy/conf.d | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| *.retry |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| --- | ||
|
|
||
| - name: Install Python 2 | ||
| hosts: all | ||
| gather_facts: false | ||
| tasks: | ||
| - raw: "[ -e /usr/bin/pyton ] || sudo apt-get update -qq && sudo apt-get install -qq python" | ||
|
|
||
| - name: Integration test for the load-balancer role | ||
| hosts: all | ||
| become: true | ||
| vars: | ||
| TEST_DOMAIN: "{{ inventory_hostname }}" | ||
| LETSENCRYPT_USE_STAGING: true | ||
| LOAD_BALANCER_MANAGE_CERTS_LOG_LEVEL: debug | ||
|
|
||
| pre_tasks: | ||
| - assert: | ||
| that: "lookup('dig', ansible_host) == lookup('dig', TEST_DOMAIN)" | ||
| msg: "The DNS entry for {{ TEST_DOMAIN }} must point to the test server." | ||
|
|
||
| roles: | ||
| - load-balancer | ||
|
|
||
| tasks: | ||
| - name: copy load-balancer configuration fragment to the server | ||
| copy: | ||
| content: | | ||
| backend be-load-balancer-test | ||
| server srv-pydoc 127.0.0.1:5000 | ||
| dest: /tmp/config-fragment | ||
| - name: copy load-balancer backend map fragment to the server | ||
| copy: | ||
| content: "{{ TEST_DOMAIN }} be-load-balancer-test\n" | ||
| dest: /tmp/backend-map-fragment | ||
| - name: apply the new configuration | ||
| command: haproxy-config apply test /tmp/config-fragment /tmp/backend-map-fragment | ||
| - name: wait for the certificate to be available | ||
| wait_for: | ||
| path: "{{ LOAD_BALANCER_CERTS_DIR }}/{{ TEST_DOMAIN }}.pem" | ||
| timeout: 360 | ||
| - name: wait for haproxy to be restarted | ||
| wait_for: | ||
| path: "{{ LOAD_BALANCER_RELOAD_FILE }}" | ||
| timeout: 100 | ||
| state: absent | ||
| - name: start pydoc as test backend on the server | ||
| become: False | ||
| command: nohup pydoc -p 5000 | ||
| async: 45 | ||
| poll: 0 | ||
| - name: verify that the backend is accessible via HTTPS | ||
| become: False | ||
| local_action: > | ||
| command wget -O- --ca-certificate=../files/lets-encrypt-fake-cert.crt \ | ||
| "https://{{ TEST_DOMAIN }}/" | ||
| - name: Remove configuration fragments again | ||
| command: haproxy-config remove test | ||
| - name: Wait for the certificate to be deleted again | ||
| wait_for: | ||
| path: "{{ LOAD_BALANCER_CERTS_DIR }}/{{ TEST_DOMAIN }}.pem" | ||
| timeout: 360 | ||
| state: absent | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ansible==2.0.1 | ||
| dnspython==1.15.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../.. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think I ran into this bug with
ansible==2.0.1.0on this async task:I was able to steer around the problem by appending
become: False. Can you add it in here since escalating to root isn't necessary for this task anyway?