Commit 3a562cf6 authored by Jakob Levisen Kvistgaard's avatar Jakob Levisen Kvistgaard
Browse files

fixed tasks and templates during testing

parent 274b3657
......@@ -13,16 +13,18 @@ all:
192.168.4.5:
vars:
robot_repos:
- drobotti-drivers
- drobotti-embedded
wiring_pi_dpkg_relative_path: 'third_part_depencies/wiringpi-2.52-arm.deb'
- { name: "drobotti-drivers", branch: "foxy"}
- { name: "drobotti-embedded"}
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: "robotti_steering", work_dir: "{{ ansible_facts.user_dir }}/drobotti-drivers", build_as_sudo: "yes" }
- { 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."}
- { name: "imu", repo: "drobotti-drivers", cmd_string: "ros2 launch imu_bno055 imu_launch.py", description: "IMU BNO055 ros2 node driver service."}
- { name: "robotti_steering", user: "root", repo: "drobotti-drivers", cmd_string: "ros2 launch robotti_steering robotti_steering_launch.py", description: "Steering ros2 node driver service."}
vm:
hosts:
192.168.4.5:
\ No newline at end of file
- name: Prime ubuntu distribution
hosts: robots
remote_user: "{{ drobotti_user }}"
gather_facts: yes
tasks:
- include_role:
name: common
tasks_from: deploy_ssh_key
- include_role:
name: common
tasks_from: auth_on_sudo_remove
- include_role:
name: common
tasks_from: change_password
\ No newline at end of file
......@@ -59,12 +59,13 @@
# tags:
# - restart
# - name: Remove services
# include_role:
# name: robotti
# tasks_from: stop_service
# tags:
# - remove
- name: Remove services
include_role:
name: robotti
tasks_from: remove_service
tags:
- setup
- remove
# - name: Fetch repositories
# include_role:
......@@ -74,10 +75,19 @@
# - setup
# - restart
# - name: Build ros2_packages
# - name: Install build dependencies
# include_role:
# name: robotti
# tasks_from: build
# tasks_from: build_dependencies
# tags:
# - setup
# - deps
# - name: Build packages
# include_role:
# name: ros2
# tasks_from: colcon_build
# with_items: '{{ packages_to_build }}'
# tags:
# - setup
# - restart
......
- name: Reload systemd
become: yes
ansible.builtin.systemd:
daemon_reload: yes
\ No newline at end of file
......@@ -35,14 +35,16 @@
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: Fetch wiringpi library #robotti_steering pkg deps
ansible.builtin.git:
repo: 'https://github.com/WiringPi/WiringPi'
dest: '{{ ansible_facts.user_dir }}/dependencies/WiringPi'
version: '7f8fe26e4f775abfced43c07657a353f03ddb2d0'
- name: Build packages
include_role:
name: ros2
tasks_from: colcon_build
with_items: '{{ packages_to_build }}'
- name: Install wiringpi
become: yes #install as sudo, node need access to phys mem and gpiomem runtime
ansible.builtin.shell:
executable: /bin/bash
cmd: './build'
chdir: '{{ ansible_facts.user_dir }}/dependencies/WiringPi'
......@@ -8,9 +8,12 @@
dest: "/etc/systemd/system/{{ item.name }}.service"
mode: '0664'
with_items: '{{ service_files }}'
notify:
- reload systemd
- name: Reload systemd
become: yes
ansible.builtin.systemd:
daemon_reload: yes
- name: Start services and enable on boot
become: yes
ansible.builtin.systemd:
......
- tags:
- always
block:
- name: Get package facts
include_role:
name: common
tasks_from: get_package_facts
when: "'packages' not in ansible_facts"
- name: Install git
include_role:
name: common
tasks_from: deploy_apt
with_items:
- git
when: "'git' not in ansible_facts.packages"
- name: Get updates from git
ansible.builtin.git:
......
......@@ -8,6 +8,7 @@
enabled: no
state: stopped
with_items: '{{ service_files }}'
ignore_errors: yes
- name: Remove service files
become: yes
......@@ -15,5 +16,8 @@
path: "/etc/systemd/system/{{ item.name }}.service"
state: absent
with_items: '{{ service_files }}'
notify:
- Reload systemd
\ No newline at end of file
- name: Reload systemd
become: yes
ansible.builtin.systemd:
daemon_reload: yes
\ No newline at end of file
......@@ -4,8 +4,8 @@ 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 }}
#ExecStop=/usr/bin/kill -15 $MAINPID
User={{ item.user | default(drobotti_user) }}
Restart=always
[Install]
......
......@@ -2,6 +2,7 @@
- always
block:
- name: "Build package {{ item.name }}"
become: "{{ item.build_as_sudo | default('no')}}"
ansible.builtin.shell:
executable: /bin/bash
cmd: "source /opt/ros/{{ ros_distro }}/setup.bash && colcon build --packages-select {{ item.name }}"
......
- name: Setup Rpi on DesktopRobotti
hosts: robots
remote_user: "{{ drobotti_user }}"
gather_facts: yes
tasks:
# - 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: 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: 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