Commit f0638605 authored by levi's avatar levi
Browse files

added services templates

parent 99961469
......@@ -16,6 +16,12 @@ all:
- drobotti-embedded
wiring_pi_dpkg_relative_path: 'third_part_depencies/wiringpi-2.52-arm.deb'
ros2_apt_depencencies:
packages_to_build:
- { name: "imu_bno055", work_dir: "{{ ansible_facts.user_dir }}/drobotti-drivers" }
# - { name: "robotti_steering", work_dir: "{{ ansible_facts.user_dir }}/drobotti-drivers" }
- { name: "rplidar_ros", work_dir: "{{ ansible_facts.user_dir }}/drobotti-drivers" }
service_files:
- { name: "rplidar", repo: "drobotti-drivers", cmd_string: "ros2 launch rplidar_ros rplidar.launch.py", description: "ROS2 lidar driver service."}
vm:
hosts:
192.168.4.5:
\ No newline at end of file
......@@ -14,6 +14,9 @@ sudo apt install ansible
-vvv
```
journalctl -u <name>
```
# guide robotti rpi
### prime ubuntu distro
......
......@@ -41,9 +41,4 @@
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
with_items: '{{ packages_to_build }}'
- name: Create systemd service files
become: yes
ansible.builtin.template:
src: service.j2
dest: "/etc/systemd/system/{{ item.name }}.service"
mode: '0664'
with_items: '{{ service_files }}'
\ No newline at end of file
[Unit]
Description={{ item.description }}
[Service]
WorkingDirectory={{ ansible_facts.user_dir }}/{{ item.repo }}
ExecStart=/usr/bin/bash -c "source /opt/ros/{{ ros_distro }}/setup.bash && source install/setup.bash && {{ item.cmd_string }}"
ExecStop=/usr/bin/kill -15 $MAINPID
User={{ drobotti_user }}
Restart=always
[Install]
WantedBy=multi-user.target
\ No newline at end of file
- name: 'Build package {{ item }}'
- name: "Build package {{ item.name }}"
ansible.builtin.shell:
executable: /bin/bash
cmd: 'source /opt/ros/{{ ros_distro }}/setup.bash && colcon build --packages-select {{ item }}'
chdir: '{{ build_path }}'
cmd: "source /opt/ros/{{ ros_distro }}/setup.bash && colcon build --packages-select {{ item.name }}"
chdir: "{{ item.work_dir }}"
......@@ -11,10 +11,10 @@
# include_role:
# name: ros2
# tasks_from: apt_sources
- name: Install ROS2 and build tools
include_role:
name: ros2
tasks_from: install_ros2
# - name: Install ROS2 and build tools
# include_role:
# name: ros2
# tasks_from: install_ros2
# NEEDS TESTING START
......@@ -28,12 +28,17 @@
# tasks_from: boot
# NEEDS TESTING END
- name: Fetch repositories
include_role:
name: robotti
tasks_from: git_packages
# - name: Fetch repositories
# include_role:
# name: robotti
# tasks_from: git_packages
- name: Build ros2_packages
include_role:
name: robotti
tasks_from: build
- name: Deploy services
include_role:
name: robotti
tasks_from: create_service
\ No newline at end of file
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