From 7ef9038de4fb69de27b93c586a0e590d9aedf735 Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Sat, 29 Aug 2020 14:36:06 +0200 Subject: [PATCH 1/6] fix: add namespace to filter plugin calls --- .github/workflows/test.yml | 8 ++++++-- __tests__/filter_plugins | 1 - __tests__/test-tf-generation.yml | 2 +- templates/terraform/nginx_server_block_docker.tf.j2 | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) delete mode 120000 __tests__/filter_plugins diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed4cafc..450c02f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,8 +19,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Install Ansible v2.10 alpha (GH actions currently uses 2.9) + run: ANSIBLE_SKIP_CONFLICT_CHECK=1 pip install --user ansible==2.10.0a9 && ansible --version - name: Get latest StackHead version - run: git clone --depth 1 --branch master https://github.com/getstackhead/stackhead.git stackhead-repo + run: ansible-galaxy collection install git+https://github.com/getstackhead/stackhead.git,feature/ansible-collection -f - run: ansible-playbook ./__tests__/test-tf-generation.yml checkLabel: @@ -37,6 +39,8 @@ jobs: if: github.event.pull_request.draft == false steps: - uses: actions/checkout@v2 + - name: Install Ansible v2.10 alpha (GH actions currently uses 2.9) + run: ANSIBLE_SKIP_CONFLICT_CHECK=1 pip install --user ansible==2.10.0a9 && ansible --version - name: Print Ansible version run: ansible --version - uses: webfactory/ssh-agent@v0.2.0 @@ -74,7 +78,7 @@ jobs: proxied: 0 token: "${{ secrets.CLOUDFLARE_TOKEN }}" zone: "${{ secrets.CLOUDFLARE_ZONE }}" - - uses: "getstackhead/stackhead@master" + - uses: getstackhead/stackhead@feature/ansible-collection with: ipaddress: ${{ steps.setup_server.outputs.hcloud_server_created_ipv4 }} domain: '${{ env.DOMAIN_NAME }}.${{ env.DOMAIN_SUFFIX }}' diff --git a/__tests__/filter_plugins b/__tests__/filter_plugins deleted file mode 120000 index eca3366..0000000 --- a/__tests__/filter_plugins +++ /dev/null @@ -1 +0,0 @@ -../stackhead-repo/ansible/filter_plugins/ \ No newline at end of file diff --git a/__tests__/test-tf-generation.yml b/__tests__/test-tf-generation.yml index 0b0cd73..c17c2f5 100644 --- a/__tests__/test-tf-generation.yml +++ b/__tests__/test-tf-generation.yml @@ -2,7 +2,7 @@ - hosts: localhost connection: local tasks: - - include_vars: "../stackhead-repo/ansible/__tests__/variables.yml" + - include_vars: "~/.ansible/collections/ansible_collections/getstackhead/stackhead/roles/stackhead_module_api/testdata/variables.yml" - set_fact: containerapp__expose: "{{ containerapp__expose|default([]) + item.expose }}" when: item.expose is defined and item.expose not in containerapp__expose|default([]) diff --git a/templates/terraform/nginx_server_block_docker.tf.j2 b/templates/terraform/nginx_server_block_docker.tf.j2 index 5da2bb3..58c12d3 100644 --- a/templates/terraform/nginx_server_block_docker.tf.j2 +++ b/templates/terraform/nginx_server_block_docker.tf.j2 @@ -3,7 +3,7 @@ resource "nginx_server_block" "nginx-{{ project_name }}" { filename = "{{ project_name }}.conf" enable = true -{%- set all_ports = containerapp__expose|containerPorts(project_name) %} +{%- set all_ports = containerapp__expose|getstackhead.stackhead.containerPorts(project_name) %} markers = { docker_ports = "{{ all_ports|map(attribute='tfstring')|join(',') }}" } @@ -47,4 +47,4 @@ EOT when = destroy command = "sudo systemctl reload nginx" } -} \ No newline at end of file +} From 316c605a7c4f4ebe1b2f8db220bf831a67234aaf Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Sat, 29 Aug 2020 15:06:52 +0200 Subject: [PATCH 2/6] fix: role path --- tasks/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 4ae1244..182a94e 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -12,4 +12,4 @@ - include_tasks: "{{ role_path }}/tasks/steps/generate-serverblock-tf.yml" # Generate SSL certificate configurations -- include_tasks: "roles/stackhead_project/tasks/ssl/ssl-config.yml" +- include_tasks: "../roles/stackhead_project/tasks/ssl/ssl-config.yml" From a576ef02aff4a249e57bcf10c2382fff3d5d4a2e Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Sat, 29 Aug 2020 15:07:32 +0200 Subject: [PATCH 3/6] fix: role path --- tasks/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 182a94e..07bf78b 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -12,4 +12,4 @@ - include_tasks: "{{ role_path }}/tasks/steps/generate-serverblock-tf.yml" # Generate SSL certificate configurations -- include_tasks: "../roles/stackhead_project/tasks/ssl/ssl-config.yml" +- include_tasks: "~/.ansible/collections/ansible_collections/getstackhead/stackhead/roles/stackhead_project/tasks/ssl/ssl-config.yml" From edde55e9cd90b583aaba801910f856fda0e4a2e0 Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Sat, 29 Aug 2020 16:17:44 +0200 Subject: [PATCH 4/6] chore: install next StackHead version --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 450c02f..6eb9dd8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: - name: Install Ansible v2.10 alpha (GH actions currently uses 2.9) run: ANSIBLE_SKIP_CONFLICT_CHECK=1 pip install --user ansible==2.10.0a9 && ansible --version - name: Get latest StackHead version - run: ansible-galaxy collection install git+https://github.com/getstackhead/stackhead.git,feature/ansible-collection -f + run: ansible-galaxy collection install git+https://github.com/getstackhead/stackhead.git,next -f - run: ansible-playbook ./__tests__/test-tf-generation.yml checkLabel: @@ -78,7 +78,7 @@ jobs: proxied: 0 token: "${{ secrets.CLOUDFLARE_TOKEN }}" zone: "${{ secrets.CLOUDFLARE_ZONE }}" - - uses: getstackhead/stackhead@feature/ansible-collection + - uses: getstackhead/stackhead@next with: ipaddress: ${{ steps.setup_server.outputs.hcloud_server_created_ipv4 }} domain: '${{ env.DOMAIN_NAME }}.${{ env.DOMAIN_SUFFIX }}' From c1f28db5e10a1798815571acf1d5c75b71f51043 Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Sat, 29 Aug 2020 16:58:47 +0200 Subject: [PATCH 5/6] chore: use stackhead__roles variable --- __tests__/test-tf-generation.yml | 2 +- tasks/deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/test-tf-generation.yml b/__tests__/test-tf-generation.yml index c17c2f5..07341b4 100644 --- a/__tests__/test-tf-generation.yml +++ b/__tests__/test-tf-generation.yml @@ -2,7 +2,7 @@ - hosts: localhost connection: local tasks: - - include_vars: "~/.ansible/collections/ansible_collections/getstackhead/stackhead/roles/stackhead_module_api/testdata/variables.yml" + - include_vars: "{{ stackhead__roles }}/stackhead_module_api/testdata/variables.yml" - set_fact: containerapp__expose: "{{ containerapp__expose|default([]) + item.expose }}" when: item.expose is defined and item.expose not in containerapp__expose|default([]) diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 07bf78b..a5894a5 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -12,4 +12,4 @@ - include_tasks: "{{ role_path }}/tasks/steps/generate-serverblock-tf.yml" # Generate SSL certificate configurations -- include_tasks: "~/.ansible/collections/ansible_collections/getstackhead/stackhead/roles/stackhead_project/tasks/ssl/ssl-config.yml" +- include_tasks: "{{ stackhead__roles }}/stackhead_module_api/tasks/ssl-certificate.yml" From 0eeb58a73330bb4e5a5270972d1a057f10946f66 Mon Sep 17 00:00:00 2001 From: Mario Lubenka Date: Sat, 29 Aug 2020 17:03:14 +0200 Subject: [PATCH 6/6] tests: fix stackhead role path --- __tests__/test-tf-generation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/__tests__/test-tf-generation.yml b/__tests__/test-tf-generation.yml index 07341b4..a31c9c0 100644 --- a/__tests__/test-tf-generation.yml +++ b/__tests__/test-tf-generation.yml @@ -1,6 +1,8 @@ --- - hosts: localhost connection: local + vars: + stackhead__roles: "~/.ansible/collections/ansible_collections/getstackhead/stackhead/roles" tasks: - include_vars: "{{ stackhead__roles }}/stackhead_module_api/testdata/variables.yml" - set_fact: