Files
pricer/basic_checks_Sloetjes.yml
T

115 lines
2.8 KiB
YAML
Raw Normal View History

2023-06-07 22:24:31 +02:00
- name: Basic system checks
hosts: all
tasks:
- name: Check to make sure the package manager is apt
fail:
msg: "Package manager is not apt"
when: "ansible_pkg_mgr != 'apt'"
- name: Clone pricer repository
hosts: target_hosts
become: yes
tasks:
- name: Check out pricer repository
git:
2023-06-12 19:55:24 +02:00
repo: https://gogs.gtsplab.com:5432/SVIG/pricer.git
dest: /Users/sloetjeswong/pricer
2023-06-07 22:24:31 +02:00
- name: Install Python requirements
hosts: target_hosts
become: yes
tasks:
- name: Install Python requirements
pip:
requirements: /Users/sloetjeswong/pricer/requirements.txt
- name: Install Chromium and Selenium
hosts: target_hosts
become: yes
tasks:
- name: Install Chromium
apt:
name: chromium-browser
state: present
- name: Install Selenium
pip:
name: selenium
state: present
# Start the container in privileged mode with:
# docker run --privileged --cgroupns=host -d -v /sys/fs/cgroup:/sys/fs/cgroup:rw dev /lib/systemd/systemd
# systemctl start snapd
# systemctl start udev
# snap install chromium
# You can use ansible.community.docker to run the container, then do all the above stuff
# docker_container_exec might be useful
#
# Translate the docker run command into the docker_container ansible module with these args:
# -v | volumes:
# --cgroupns | cgroupns_mode:
2023-06-12 19:55:24 +02:00
# -d | detach: true
# Adds on 06/12:
- name: Run pricer container with systemd
hosts: all
become: true
tasks:
- name: Install Docker
apt:
name: docker.io
state: present
- name: Start Docker service
service:
name: docker
state: started
- name: Run pricer container
docker_container:
name: pricer
image: ubuntu
state: started
restart_policy: always
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: yes
ports:
- "9515:9515"
command: /sbin/init
- name: Start snapd and udev in the pricer container
hosts: all
become: true
tasks:
- name: Start snapd and udev
2023-06-12 21:31:44 +02:00
docker_container:
2023-06-12 19:55:24 +02:00
name: pricer
command: systemctl start snapd udev
- name: Install chromium using snap in the pricer container
hosts: all
become: true
tasks:
- name: Install chromium
2023-06-12 21:33:49 +02:00
docker_container:
2023-06-12 19:55:24 +02:00
name: pricer
command: snap install chromium
- name: Run latest version of scraper
hosts: all
become: true
tasks:
- name: Clone pricer repository
git:
2023-06-12 20:05:29 +02:00
repo: https://gogs.gtsplab.com:5432/SVIG/pricer.git
2023-06-12 19:55:24 +02:00
dest: /Users/sloetjeswong/pricer
version: master
- name: Install dependencies
pip:
requirements: /Users/sloetjeswong/pricer/requirements.txt
- name: Run scraper
2023-06-12 21:31:44 +02:00
command: python /Users/sloetjeswong/pricer/fp_merge.py