Commit 8d521472 authored by Jakob Levisen Kvistgaard's avatar Jakob Levisen Kvistgaard
Browse files

small fixes added udev tasks

parent 323a12b4
##### dev cmds. # Ansible deployment for desktop robotti RPI
The playbooks are only tested on ubuntu20.04 controller, but should work on any debian distribution..
## dependencies
sudo apt install ansible
##### dev
- debug: - debug:
msg: "{{ ansible_facts }}" msg: "{{ ansible_facts }}"
-vvv
# guide robotti rpi # guide robotti rpi
...@@ -11,6 +20,8 @@ ...@@ -11,6 +20,8 @@
ansible-playbook -i inventory/hosts prime_ubuntu.yml -kK ansible-playbook -i inventory/hosts prime_ubuntu.yml -kK
Type in same password.
note: password changed to: drobotti note: password changed to: drobotti
### Setup robotti ### Setup robotti
......
- 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
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
state: present state: present
owner: root owner: root
group: root group: root
line: "{{ ansible_user }} ALL=(ALL:ALL) NOPASSWD: ALL" line: "{{ drobotti_user }} ALL=(ALL:ALL) NOPASSWD: ALL"
path: "/etc/sudoers.d/{{ ansible_user }}" path: "/etc/sudoers.d/{{ drobotti_user }}"
mode: '0400' mode: '0400'
\ No newline at end of file
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
- name: Change user password - name: Change user password
become: yes become: yes
ansible.builtin.user: ansible.builtin.user:
name: "ubuntu" name: "{{ drobotti_user }}"
update_password: always update_password: always
password: "{{ drobotti_password | password_hash('sha512') }}" password: "{{ drobotti_password | password_hash('sha512') }}"
\ No newline at end of file
- name: "Add {{ drobotti_user }} user to dialout group"
become: yes
ansible.builtin.user:
name: "{{ drobotti_user }}"
groups:
- dialout
- set_fact:
usb_udev_rule: "KERNEL==\"ttyUSB*\""
i2c_udev_rule: "KERNEL==\"i2c*\""
acm_udev_rule: "KERNEL==\"ttyACM*\""
udev_string: "MODE=\"0666\" OWNER=\"root\" GROUP=\"dialout\""
- name: Setup usb udev rule
become: yes
ansible.builtin.lineinfile:
create: yes
state: present
line: "{{ usb_udev_rule }} {{ udev_string }}"
path: "/etc/udev/rules.d/usb.rules"
mode: '0664'
- name: Setup i2c udev rule
become: yes
ansible.builtin.lineinfile:
create: yes
state: present
line: "{{ i2c_udev_rule }} {{ udev_string }}"
path: "/etc/udev/rules.d/i2c.rules"
mode: '0664'
- name: Setup acme udev rule
become: yes
ansible.builtin.lineinfile:
create: yes
state: present
line: "{{ acm_udev_rule }} {{ udev_string }}"
path: "/etc/udev/rules.d/acm.rules"
mode: '0664'
- name: Reload udev
become: yes
ansible.builtin.shell:
cmd: udevadm control --reload-rules && udevadm trigger
\ No newline at end of file
Supports Markdown
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