Skip to content

Commit c6796be

Browse files
committed
address review comments
1 parent b6024e3 commit c6796be

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

ctf/templates/new/rust-webservice/build.yaml.j2

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This Ansible script is used to compile your challenge, create an archive and extract that archive on to the local host.
2-
# This script only shows a proof of concept of building a C program. Change it as per your needs.
2+
# This script builds a frontend using NPM and a Rust program. Change it as per your needs.
33
- name: "Build container"
44
hosts: "build-container"
55
vars_files:
@@ -13,6 +13,11 @@
1313
ansible.builtin.set_fact:
1414
track_flags: "{{ '{{ track_flags | default({}) | combine({key: value}) }}' }}"
1515

16+
- name: Check if IPv4 address is set
17+
ansible.builtin.debug:
18+
msg: IPv4 address is set
19+
when: ansible_all_ipv4_addresses | length > 0
20+
1621
- name: Initial System Upgrade
1722
ansible.builtin.apt:
1823
update_cache: true
@@ -58,11 +63,17 @@
5863
group: root
5964
mode: '0644'
6065

61-
- name: NPM install
66+
- name: NPM install (if IPv4)
6267
community.general.npm:
6368
path: /tmp/{{ data.name }}/client/
6469
environment:
6570
NODE_OPTIONS: "--dns-result-order=ipv4first"
71+
when: ansible_all_ipv4_addresses | length > 0
72+
73+
- name: NPM install (if IPv6)
74+
community.general.npm:
75+
path: /tmp/{{ data.name }}/client/
76+
when: ansible_all_ipv4_addresses | length == 0
6677

6778
- name: Build
6879
ansible.builtin.command:

0 commit comments

Comments
 (0)