From afd3361766a483c38116f93e9002230a29e2746c Mon Sep 17 00:00:00 2001 From: Karen Zeng Date: Mon, 19 Jun 2023 17:02:41 -0400 Subject: [PATCH] Checked the port and set the chrome_options --- basic_checks.yml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/basic_checks.yml b/basic_checks.yml index dafaa53..822d5d2 100644 --- a/basic_checks.yml +++ b/basic_checks.yml @@ -165,9 +165,39 @@ name: chromium-browser state: present +- name: Verify the chromium browser is running at the specified port + hosts: docker_container + become: true + tasks: + - name: install the net-tools + apt: + name: net-tools + state: present + - name: Get Chromium browser port + command: netstat -tlnp | grep chromium | awk '{split($4,a,":"); print a[length(a)]}' + register: chromium_port + - name: Display Chromium browser port + debug: + var: chromium_port.stdout + - name: Run latest version of scraper hosts: docker_container become: true tasks: + - name: Set up Chrome options + set_fact: + chrome_options: + - "--headless" + - "--no-sandbox" + - "--disable-dev-shm-usage" + - name: Debug chrome_options variable + debug: + var: chrome_options + - name: Run scraper - command: python3 /opt/pricer/fp_merge.py + ansible.builtin.script: + script: /opt/pricer/fp2_13.py + executable: /usr/bin/python3 + environment: + PATH: "/usr/bin/chromedriver/:{{ ansible_env.PATH }}" + CHROME_OPTIONS: "{{ chrome_options | join(' ') }}" \ No newline at end of file