Compare commits
No commits in common. "daa6861b07046d6fa8e057d5f94e2f6d0ab9e789" and "c6f5f8a1851322fe9924441f11187ac10a73355a" have entirely different histories.
daa6861b07
...
c6f5f8a185
2
ansible/group_vars/all/rabbitmq_credentials.yaml
Normal file
2
ansible/group_vars/all/rabbitmq_credentials.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
rabbitmq_user: satanas
|
||||
rabbitmq_password: satanas
|
@ -1,5 +1,9 @@
|
||||
[car]
|
||||
satanas.local ansible_user=pi become=yes become_user=root
|
||||
diabolo.local ansible_user=pi become=yes become_user=root
|
||||
|
||||
[microservice]
|
||||
diabolo.local
|
||||
|
||||
[donkey]
|
||||
satanas.local
|
||||
|
@ -93,4 +93,3 @@ dtoverlay=pi3-disable-bt
|
||||
gpu_mem=256
|
||||
|
||||
dtoverlay=w1-gpio
|
||||
enable_uart=1
|
||||
|
@ -481,24 +481,3 @@ fr_FR.UTF-8 UTF-8
|
||||
# zh_TW.UTF-8 UTF-8
|
||||
# zu_ZA ISO-8859-1
|
||||
# zu_ZA.UTF-8 UTF-8
|
||||
# agr_PE UTF-8
|
||||
# az_IR UTF-8
|
||||
# bho_NP UTF-8
|
||||
# bi_VU UTF-8
|
||||
# ca_ES@valencia UTF-8
|
||||
# dsb_DE UTF-8
|
||||
# el_GR@euro ISO-8859-7
|
||||
# en_SC.UTF-8 UTF-8
|
||||
# hif_FJ UTF-8
|
||||
# kab_DZ UTF-8
|
||||
# mai_NP UTF-8
|
||||
# mfe_MU UTF-8
|
||||
# miq_NI UTF-8
|
||||
# mjw_IN UTF-8
|
||||
# mnw_MM UTF-8
|
||||
# sah_RU UTF-8
|
||||
# shn_MM UTF-8
|
||||
# sm_WS UTF-8
|
||||
# to_TO UTF-8
|
||||
# tpi_PG UTF-8
|
||||
# yuw_PG UTF-8
|
||||
|
35
ansible/roles/docker/tasks/docker.yml
Normal file
35
ansible/roles/docker/tasks/docker.yml
Normal file
@ -0,0 +1,35 @@
|
||||
- name: Add apt key
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/debian/gpg
|
||||
|
||||
- name: Add docker-ce repository
|
||||
apt_repository:
|
||||
repo: deb [arch={{ arch | default('armhf') }}] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable
|
||||
state: present
|
||||
filename: 'docker'
|
||||
|
||||
|
||||
- meta: flush_handlers
|
||||
|
||||
- name: Install docker-ce
|
||||
apt:
|
||||
name:
|
||||
- python3-pip
|
||||
- docker-ce
|
||||
- xfsprogs
|
||||
state: present
|
||||
|
||||
- name: Set groups to pi user
|
||||
user:
|
||||
name: pi
|
||||
groups: docker
|
||||
|
||||
- meta: flush_handlers
|
||||
- name: Install ansible tool docker and docker-compose
|
||||
pip:
|
||||
name:
|
||||
- docker-compose
|
||||
executable: pip3
|
||||
|
||||
|
||||
|
4
ansible/roles/docker/tasks/main.yml
Normal file
4
ansible/roles/docker/tasks/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
- include_tasks: docker.yml
|
||||
|
13
ansible/roles/donkey/defaults/main.yml
Normal file
13
ansible/roles/donkey/defaults/main.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
donkey_username: pi
|
||||
donkey_groupname: pi
|
||||
donkey_home_dir: /home/{{ donkey_username }}
|
||||
|
||||
donkey_git_repo: https://github.com/cyrilix/donkey.git
|
||||
donkey_git_branch: master
|
||||
|
||||
donkey_sources: "{{ donkey_home_dir }}/donkeycar"
|
||||
donkey_virtualenv_dir: "{{ donkey_home_dir }}/venv"
|
||||
|
||||
donkey_data_dir: "{{ donkey_home_dir }}/data"
|
16
ansible/roles/donkey/tasks/data.yml
Normal file
16
ansible/roles/donkey/tasks/data.yml
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
- name: Make data directory
|
||||
file:
|
||||
path: "{{ donkey_data_dir }}"
|
||||
owner: "{{ donkey_username }}"
|
||||
group: "{{ donkey_groupname }}"
|
||||
state: directory
|
||||
|
||||
- name: Make tmpfs
|
||||
mount:
|
||||
path: "{{ donkey_data_dir }}"
|
||||
src: tmpfs
|
||||
fstype: tmpfs
|
||||
opts: defaults
|
||||
state: mounted
|
62
ansible/roles/donkey/tasks/main.yml
Normal file
62
ansible/roles/donkey/tasks/main.yml
Normal file
@ -0,0 +1,62 @@
|
||||
---
|
||||
|
||||
- include_tasks: data.yml
|
||||
|
||||
- name: Install dependencies
|
||||
apt:
|
||||
name:
|
||||
- python3-setuptools-git
|
||||
- virtualenv
|
||||
- libopenjp2-7
|
||||
- libtiff5
|
||||
- libblas3
|
||||
- liblapack3
|
||||
- libatlas3-base
|
||||
- libjpeg-dev
|
||||
- libilmbase12
|
||||
- libopenexr22
|
||||
- libgstreamer1.0-0
|
||||
- libavcodec57
|
||||
- libavformat57
|
||||
- libswscale4
|
||||
- libgtk-3-0
|
||||
- i2c-tools
|
||||
- read-edid
|
||||
- libsdl1.2debian
|
||||
- libjasper1
|
||||
- libqtgui4
|
||||
- libqt4-test
|
||||
- python-h5py
|
||||
state: present
|
||||
|
||||
- name: Fetch git repository
|
||||
become_user: "{{ donkey_username }}"
|
||||
git:
|
||||
repo: "{{ donkey_git_repo }}"
|
||||
dest: "{{ donkey_sources }}"
|
||||
version: "{{ donkey_git_branch }}"
|
||||
ssh_opts: "-o StrictHostKeyChecking=no"
|
||||
|
||||
- name: Install donkey
|
||||
become_user: "{{ donkey_username }}"
|
||||
pip:
|
||||
name: "{{ donkey_sources }}"
|
||||
virtualenv_python: python3
|
||||
virtualenv: "{{ donkey_virtualenv_dir }}"
|
||||
editable: yes
|
||||
|
||||
|
||||
#- name: Install dependencies
|
||||
# become_user: "{{ donkey_username }}"
|
||||
# pip:
|
||||
# requirements: "{{ donkey_sources }}/requirements-pi.txt"
|
||||
# virtualenv: "{{ donkey_virtualenv_dir }}"
|
||||
# virtualenv_python: python3
|
||||
|
||||
- name: Load virtualenv at connection
|
||||
template:
|
||||
src: bash_custom
|
||||
dest: "{{ donkey_home_dir }}/.bash_custom"
|
||||
owner: "{{ donkey_username }}"
|
||||
group: "{{ donkey_groupname }}"
|
||||
mode: 0644
|
2
ansible/roles/donkey/templates/bash_custom
Normal file
2
ansible/roles/donkey/templates/bash_custom
Normal file
@ -0,0 +1,2 @@
|
||||
# Activate virtualenv
|
||||
source {{ donkey_virtualenv_dir }}/bin/activate
|
@ -1,3 +1,3 @@
|
||||
---
|
||||
k3s_version: v1.25.3%2Bk3s1
|
||||
k3s_version: v1.22.5%2Bk3s1
|
||||
k3s_url: https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/k3s-{{ arch | default('armhf') }}
|
||||
|
@ -26,4 +26,4 @@ RestartSec=5s
|
||||
ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service'
|
||||
ExecStartPre=-/sbin/modprobe br_netfilter
|
||||
ExecStartPre=-/sbin/modprobe overlay
|
||||
ExecStart=/usr/local/bin/k3s server --disable traefik --disable-helm-controller
|
||||
ExecStart=/usr/local/bin/k3s server
|
||||
|
4
ansible/roles/python/defaults/main.yml
Normal file
4
ansible/roles/python/defaults/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
version: 3.6.6
|
||||
threads: 4
|
52
ansible/roles/python/tasks/main.yml
Normal file
52
ansible/roles/python/tasks/main.yml
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
|
||||
- name: "Install python {{version}} runtime & build dependencies"
|
||||
become: yes
|
||||
apt: name={{item}}
|
||||
with_items:
|
||||
- build-essential
|
||||
- tk-dev
|
||||
- libncurses5-dev
|
||||
- libncursesw5-dev
|
||||
- libreadline6-dev
|
||||
- libdb5.3-dev
|
||||
- libgdbm-dev
|
||||
- libsqlite3-dev
|
||||
- libssl-dev
|
||||
- libbz2-dev
|
||||
- libexpat1-dev
|
||||
- liblzma-dev
|
||||
- libffi-dev
|
||||
- uuid-dev
|
||||
- zlib1g-dev
|
||||
|
||||
- name: "Download python{{version}}"
|
||||
get_url:
|
||||
url: "https://www.python.org/ftp/python/{{version}}/Python-{{version}}.tar.xz"
|
||||
dest: "/tmp/Python-{{version}}.tar.xz"
|
||||
|
||||
- name: "Unarchive python{{version}}"
|
||||
unarchive:
|
||||
src: "/tmp/Python-{{version}}.tar.xz"
|
||||
dest: "/tmp/"
|
||||
copy: no
|
||||
creates: "/tmp/Python-{{version}}"
|
||||
|
||||
- name: "configure python{{version}} build"
|
||||
command: ./configure --prefix=/opt/python-{{version}} --enable-optimizations
|
||||
args:
|
||||
chdir: "/tmp/Python-{{version}}"
|
||||
creates: "/tmp/Python-{{version}}/Makefile"
|
||||
|
||||
- name: "build python{{version}}"
|
||||
# not using make module to be able to use -j and creates option to fully skip step
|
||||
command: make -j{{threads}}
|
||||
args:
|
||||
chdir: "/tmp/Python-{{version}}"
|
||||
creates: "/tmp/Python-{{version}}/python"
|
||||
|
||||
- name: "install python{{version}}"
|
||||
become: yes
|
||||
make:
|
||||
chdir: "/tmp/Python-{{version}}"
|
||||
target: altinstall
|
11
ansible/roles/rabbitmq/handlers/main.yml
Normal file
11
ansible/roles/rabbitmq/handlers/main.yml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- name: expand filesystem
|
||||
shell: resize2fs /dev/mmcblk0p2
|
||||
notify:
|
||||
- reboot
|
||||
|
||||
- name: restart rabbitmq
|
||||
service:
|
||||
name: rabbitmq-server
|
||||
start: restarted
|
||||
|
35
ansible/roles/rabbitmq/tasks/main.yml
Normal file
35
ansible/roles/rabbitmq/tasks/main.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: Install ansible dependencies
|
||||
apt:
|
||||
name: "python3-requests"
|
||||
state: present
|
||||
|
||||
- name: Install rabbitmq package
|
||||
apt:
|
||||
name: rabbitmq-server
|
||||
state: present
|
||||
with_items:
|
||||
- rabbitmq-server
|
||||
- python3-requests
|
||||
|
||||
- name: Enables rabbitmq plugins
|
||||
rabbitmq_plugin:
|
||||
names: rabbitmq_management,rabbitmq_mqtt
|
||||
state: enabled
|
||||
|
||||
- name: Add rabbitmq user
|
||||
rabbitmq_user:
|
||||
user: "{{ rabbitmq_user }}"
|
||||
password: "{{ rabbitmq_password }}"
|
||||
vhost: /
|
||||
configure_priv: .*
|
||||
read_priv: .*
|
||||
write_priv: .*
|
||||
tags: administrator
|
||||
state: present
|
||||
|
||||
- name: Create exchange
|
||||
rabbitmq_exchange:
|
||||
name: car
|
||||
type: topic
|
||||
vhost: "/"
|
@ -8,5 +8,13 @@
|
||||
- hosts: microservice
|
||||
become: yes
|
||||
roles:
|
||||
- { role: rabbitmq, tags: [rabbitmq] }
|
||||
- { role: k3s, tags: [k3s] }
|
||||
- { role: microservices, tags: [microservices, ms] }
|
||||
|
||||
|
||||
- hosts: donkey
|
||||
become: yes
|
||||
roles:
|
||||
- { role: python, tags: [python]}
|
||||
- { role: donkey, tags: [donkey] }
|
||||
|
Loading…
Reference in New Issue
Block a user