Commit 99961469 authored by levi's avatar levi
Browse files

added tasks for build, git and deps

parent d471610a
- name: Setup Rpi on DesktopRobotti
hosts: robots
remote_user: "{{ drobotti_user }}"
gather_facts: yes
tasks:
- name: Setup devices configuration
include_role:
name: robotti
tasks_from: udev
- name: Enable SPI for IMU
become: yes
ansible.builtin.lineinfile:
create: yes
owner: root
group: root
state: present
line: 'dtoverlay=i2c-gpio,bus=3'
path: '/boot/firmware/usercfg.txt'
mode: '0755'
register: setup_boot_cfg
- name: Reboot
become: yes
ansible.builtin.reboot:
reboot_timeout: 1200
when: 'setup_boot_cfg.changed == true'
\ No newline at end of file
- name: Install ros2 apt dependencies
include_role:
name: common
tasks_from: deploy_apt
with_items: '{{ ros2_apt_depencencies }}'
- name: Install python3-rosdep2
become: yes
ansible.builtin.apt:
state: present
pkg: python3-rosdep2
register: 'status_deploy_rosdep'
- name: Rosdep init
become: yes
ansible.builtin.shell:
executable: /bin/bash
cmd: rosdep init
when: 'status_deploy_rosdep.changed == true'
- name: Rosdep update sources
ansible.builtin.shell:
executable: /bin/bash
cmd: rosdep update
# TODO: Change to generic, when we we got same src structure?
- name: Install ros package depencies.
ansible.builtin.shell:
executable: /bin/bash
cmd: 'source /opt/ros/{{ ros_distro }}/setup.bash && rosdep install --from-paths src --ignore-src -y'
chdir: '{{ ansible_facts.user_dir }}/drobotti-drivers'
with_items: 'drobotti-drivers'
# Wiring pi dependency
# - name: Deploy wiringpi
# become: yes
# ansible.builtin.shell:
# cmd: 'dpkg -i {{ ansible_facts.user_dir }}/drobotti-drivers/{{ wiring_pi_dpkg_relative_path }}'
- name: Build packages
include_role:
name: ros2
tasks_from: colcon_build
vars:
build_path: "{{ ansible_facts.user_dir }}/drobotti-drivers"
with_items:
- imu_bno055
# - robotti_steering
- rplidar_ros
\ No newline at end of file
- name: Install git
include_role:
name: common
tasks_from: deploy_apt
with_items:
- git
- name: Get updates from git
ansible.builtin.git:
repo: '{{ gitlab_repos_host }}/{{ item }}.git'
dest: '{{ ansible_facts.user_dir }}/{{ item }}'
with_items: '{{ robot_repos }}'
......@@ -6,9 +6,9 @@
- dialout
- set_fact:
usb_udev_rule: "KERNEL==\"ttyUSB*\""
i2c_udev_rule: "KERNEL==\"i2c*\""
acm_udev_rule: "KERNEL==\"ttyACM*\""
usb_udev_target: "KERNEL==\"ttyUSB*\""
i2c_udev_target: "KERNEL==\"i2c*\""
acm_udev_target: "KERNEL==\"ttyACM*\""
udev_string: "MODE=\"0666\" OWNER=\"root\" GROUP=\"dialout\""
- name: Setup usb udev rule
......@@ -16,7 +16,7 @@
ansible.builtin.lineinfile:
create: yes
state: present
line: "{{ usb_udev_rule }} {{ udev_string }}"
line: "{{ usb_udev_target }} {{ udev_string }}"
path: "/etc/udev/rules.d/usb.rules"
mode: '0664'
......@@ -25,7 +25,7 @@
ansible.builtin.lineinfile:
create: yes
state: present
line: "{{ i2c_udev_rule }} {{ udev_string }}"
line: "{{ i2c_udev_target }} {{ udev_string }}"
path: "/etc/udev/rules.d/i2c.rules"
mode: '0664'
......@@ -34,7 +34,7 @@
ansible.builtin.lineinfile:
create: yes
state: present
line: "{{ acm_udev_rule }} {{ udev_string }}"
line: "{{ acm_udev_target }} {{ udev_string }}"
path: "/etc/udev/rules.d/acm.rules"
mode: '0664'
......
- name: 'Build package {{ item }}'
ansible.builtin.shell:
executable: /bin/bash
cmd: 'source /opt/ros/{{ ros_distro }}/setup.bash && colcon build --packages-select {{ item }}'
chdir: '{{ build_path }}'
......@@ -2,20 +2,6 @@
name: common
tasks_from: get_package_facts
- name: Deploy ROS2 Desktop
become: yes
ansible.builtin.apt:
name: "ros-{{ ros_distro }}-desktop"
state: present
when: "'ubuntu-desktop' in ansible_facts.packages"
- name: Deploy ROS2 Base
become: yes
ansible.builtin.apt:
name: "ros-{{ ros_distro }}-ros-base"
state: present
when: "'ubuntu-desktop' not in ansible_facts.packages"
- name: Install python
include_role:
name: common
......@@ -25,6 +11,22 @@
- python3-pip
when: "'python3' not in ansible_facts.packages or 'python3-pip' not in ansible_facts.packages"
- name: Deploy ROS2 Desktop
include_role:
name: common
tasks_from: deploy_apt
with_items:
- 'ros-{{ ros_distro }}-desktop'
when: "'ubuntu-desktop' in ansible_facts.packages"
- name: Deploy ROS2 Base
include_role:
name: common
tasks_from: deploy_apt
with_items:
- 'ros-{{ ros_distro }}-ros-base'
when: "'ubuntu-desktop' not in ansible_facts.packages"
- name: Deploy colcon build tools
include_role:
name: common
......
......@@ -3,15 +3,37 @@
remote_user: "{{ drobotti_user }}"
gather_facts: yes
tasks:
- name: ROS2 setup locale
# - name: ROS2 setup locale #tested
# include_role:
# name: ros2
# tasks_from: locales
# - name: Set ROS2 apt sources
# include_role:
# name: ros2
# tasks_from: apt_sources
- name: Install ROS2 and build tools
include_role:
name: ros2
tasks_from: locales
- name: Set ROS2 apt sources
tasks_from: install_ros2
# NEEDS TESTING START
# - name: Setup devices configuration
# include_role:
# name: robotti
# tasks_from: udev
# - name: Setup /boot/firmware/usercfg.txt
# include_role:
# name: robotti
# tasks_from: boot
# NEEDS TESTING END
- name: Fetch repositories
include_role:
name: ros2
tasks_from: apt_sources
- name: Install ROS2 and build tools
name: robotti
tasks_from: git_packages
- name: Build ros2_packages
include_role:
name: ros2
tasks_from: install_ros2
\ No newline at end of file
name: robotti
tasks_from: build
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment