-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add snowflake proxy role, fix ci (#98)
* Add molecule ci config of snowflake proxy role * Fix ci tests
- Loading branch information
Showing
12 changed files
with
134 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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 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 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,12 @@ | ||
--- | ||
|
||
- import_playbook: ansible-version.yml | ||
|
||
- name: "Deploy snowflake proxy" | ||
hosts: "{{ target if target is defined else 'snowflake' }}" | ||
become: true | ||
gather_facts: true | ||
roles: | ||
- admin | ||
- update | ||
- snowflake |
This file contains 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 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 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 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 |
---|---|---|
|
@@ -6,3 +6,6 @@ testing.privacylx.org | |
|
||
[matterbridge] | ||
testing.privacylx.org | ||
|
||
[snowflake] | ||
testing.privacylx.org |
This file contains 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,4 @@ | ||
--- | ||
|
||
sf_iptables_manage: true | ||
sf_galaxy_role: nvjacobo.snowflake |
This file contains 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,30 @@ | ||
--- | ||
|
||
driver: | ||
name: vagrant | ||
provider: | ||
name: libvirt | ||
|
||
lint: | | ||
set -e | ||
yamllint . | ||
platforms: | ||
- name: debian11-instance | ||
box: generic/debian11 | ||
memory: 2000 | ||
cpus: 1 | ||
groups: | ||
- snowflake | ||
|
||
provisioner: | ||
name: ansible | ||
options: | ||
verbose: true | ||
lint: | ||
name: ansible-lint | ||
inventory: | ||
links: | ||
group_vars: ../../../../inventory/molecule/group_vars/ | ||
playbooks: | ||
converge: ../../../../deploy-snowflake.yml |
This file contains 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,62 @@ | ||
--- | ||
|
||
- name: Gather the package facts | ||
package_facts: | ||
|
||
- name: Setup iptables | ||
block: | ||
- name: Set the iptables policy for the INPUT chain to ACCEPT | ||
iptables: | ||
ip_version: "ip{{ item }}" | ||
chain: INPUT | ||
policy: ACCEPT | ||
with_items: | ||
- v4 | ||
- v6 | ||
|
||
- name: Save current state of the firewall (iptables) in the system file | ||
community.general.iptables_state: | ||
ip_version: "ip{{ item }}" | ||
state: saved | ||
path: "/etc/iptables/rules.{{ item }}" | ||
with_items: | ||
- v4 | ||
- v6 | ||
when: | ||
- "'iptables' in ansible_facts.packages" | ||
- sf_iptables_manage | ||
|
||
# TODO add versioning once the git repo provides releases | ||
- name: Install snowflake ansible role | ||
community.general.ansible_galaxy_install: | ||
type: role | ||
name: "{{ sf_galaxy_role }}" | ||
dest: "{{ galaxy_path }}" | ||
become: false | ||
delegate_to: localhost | ||
|
||
# TODO: fix idempotency of service start | ||
- name: Import snowflake ansible galaxy role | ||
include_role: | ||
name: "{{ galaxy_path }}/{{ sf_galaxy_role }}" | ||
public: true | ||
tags: molecule-idempotence-notest | ||
|
||
- name: Query systemd journal to get the proxy NAT type of snowflake | ||
retries: 5 | ||
delay: 10 | ||
command: 'journalctl -r -n 1 -o cat -u snowflake-proxy --grep="NAT type:"' | ||
register: sf_nat_type | ||
until: sf_nat_type.rc == 0 | ||
tags: molecule-idempotence-notest | ||
|
||
- name: Show snowflake proxy NAT type | ||
debug: | ||
msg: "{{ sf_nat_type.stdout }}" | ||
tags: molecule-idempotence-notest | ||
|
||
- name: Assert snowflake proxy NAT is unrestricted | ||
assert: | ||
that: "'unrestricted' in sf_nat_type.stdout" | ||
fail_msg: "[ERR] snowflake proxy NAT type is not unrestricted" | ||
tags: molecule-notest |
This file contains 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 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