ansible/roles/development/tasks/main.yml

336 lines
7.7 KiB
YAML

- name: install dev tools
ansible.builtin.apt: name={{ item }} state=present
become: true
with_items:
- autoconf
- automake
- build-essential
- clang
- cloc
- cmake
- devscripts
- gcc
- ghc
- git
- golang-google-genproto-dev
- golang-goprotobuf-dev
- golang-protobuf-extensions-dev
- graphviz
- ipython3
- jq
- libprotobuf-dev
- lua5.3
- luarocks
- make
- mercurial
- pgcli
- protobuf-compiler
- python3-pip
- python3-progressbar
- python3-pycryptodome
- sbcl
- texinfo
- tig
- tshark
- yamllint
- zlib1g
- zlib1g-dev
# prefer python3-$package instead of using pip.
- name: install various python utils
ansible.builtin.pip:
executable: pip3
name: "{{item}}"
extra_args: --user
with_items:
- yq
- name: install dev tools with guis
when: not headless
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- erlang
- name: install headless dev tools
when: headless
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- erlang-nox
## golang
- name: install godeb
become: true
ansible.builtin.unarchive:
src: "{{ role_path }}/files/godeb-amd64.tar.gz"
dest: /usr/local/bin
creates: /usr/local/bin/godeb
- name: install go
become: true
ansible.builtin.command: godeb install "{{ go_version }}"
args:
chdir: /tmp
creates: /usr/local/go/bin/go
## bazel
- name: "install bazelisk v{{ bazelisk_version }}"
ansible.builtin.get_url:
checksum: sha256:168851e70cf5f95c0e215e7f3aaca5132ffc3c8dd8f585a4157b0be2b53cfe32
dest: "/home/{{ laptop_user }}/.local/bin/bazelisk"
mode: 0755
url: "https://github.com/bazelbuild/bazelisk/releases/download/v{{ bazelisk_version }}/bazelisk-linux-amd64"
# the process of getting buildifier in an automated way is onerous, ergo
# this hack.
- name: install buildifier
ansible.builtin.unarchive:
src: "{{ role_path }}/files/buildifier.tgz"
dest: "/home/{{ laptop_user }}/.local/bin"
creates: "/home/{{ laptop_user }}/.local/bin/buildifier"
## virtualization and containerization
- name: ensure repository key is installed
when: dev_virt or dev_full
become: true
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: ensure docker registry is available
when: dev_virt or dev_full
become: true
ansible.builtin.apt_repository: repo='deb https://download.docker.com/linux/ubuntu bionic stable' state=present
- name: rootfs building tools
when: dev_virt or dev_full
ansible.builtin.apt: name={{ item }} state=present
become: true
with_items:
- dosfstools
- dracut
- e2fsprogs
- fusecram
- genext2fs
- genisoimage
- genromfs
- makebootfat
- mmdebstrap
- proot
- pxelinux
- syslinux
- syslinux-efi
- syslinux-utils
- vboot-utils
- whois
- name: install container and virtualisation management
when: dev_virt or dev_full
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- conman
- crun
- docker-ce
- docker-compose
- ipxe-qemu
- kvmtool
- podman
- qemubuilder
- qemu-efi-aarch64
- qemu-efi-arm
- qemu-system-arm
- qemu-system
- qemu-system-x86
- qemu-user-static
- sbuild-qemu
- seabios
- u-boot-qemu
- virt-top
notify: "restart docker service"
- name: install container and virtualisation GUIs
when: (dev_virt or dev_full) and not headless
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- qemu-system-gui
- virt-manager
- name: Ensure kvm group exists
when: dev_virt or dev_full
become: true
ansible.builtin.group:
name: kvm
state: present
- name: Ensure docker group exists
when: dev_virt or dev_full
become: true
ansible.builtin.group:
name: docker
state: present
- name: add laptop user {{ laptop_user }} to docker group
when: dev_virt or dev_full
become: true
ansible.builtin.user:
name: "{{ laptop_user }}"
append: true
groups:
- docker
## embedded dev stuff
- name: installed embedded dev tools
when: dev_embedded or dev_full
ansible.builtin.apt: name={{ item }} state=present
become: true
with_items:
- avr-libc
- avrdude
- binutils-arm-none-eabi
- binutils-arm-linux-gnueabi
- binutils-arm-linux-gnueabihf
- binutils-avr
- dfu-util
- gcc-arm-none-eabi
- gcc-arm-linux-gnueabi
- gcc-arm-linux-gnueabihf
- gcc-avr
- libstdc++-arm-none-eabi-newlib
- libusb-0.1-4
- libusb-1.0-0
- libusb-1.0-0-dev
- libusb-1.0-doc
- libusb-dev
- picocom
- python3-usb
- name: install embedded dev guis
when: (dev_virt or dev_full) and not headless
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- pulseview
- sigrok
## documentation stuff
- name: install documentation tooling
become: true
ansible.builtin.apt: name={{ item }} state=present
with_items:
- asciidoc
- doxygen
- pelican
- pelican-doc
- python3-sphinx
- scdoc
## vscode
- name: add VS Code repo key
when: dev_full and not headless
become: true
ansible.builtin.apt_key:
url: https://packages.microsoft.com/keys/microsoft.asc
state: present
validate_certs: yes
- name: add VS Code repo
when: dev_full and not headless
become: true
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
state: present
validate_certs: yes
- name: install VS Code
when: dev_full and not headless
become: true
ansible.builtin.apt: name=code state=present
## rust
- name: check if cargo is installed
when: dev_rust or dev_full
shell: command -v cargo
register: cargo_exists
ignore_errors: yes
- name: Download Installer
when: (dev_rust or dev_full) and (cargo_exists is failed)
get_url:
url: https://sh.rustup.rs
dest: /tmp/sh.rustup.rs
mode: '0755'
force: 'yes'
- name: install rust/cargo
when: (dev_rust or dev_full) and (cargo_exists is failed)
shell: /tmp/sh.rustup.rs -y --no-modify-path
## AI/ML stuff
- name: install machine learning and AI tools
when: dev_full
become: true
ansible.builtin.apt:
name: "{{item}}"
state: present
with_items:
- jupyter-notebook
- name: install machine learning and AI python packages
when: dev_full
ansible.builtin.pip:
executable: pip3
name: "{{item}}"
extra_args: --user
with_items:
- Keras
- numpy
- scikit-learn
- scipy
- tensorflow
- torch
- name: install balena etcher repo key
become: true
when: (dev_full or dev_embedded) and not headless
ansible.builtin.apt_key:
url: https://dl.cloudsmith.io/public/balena/etcher/gpg.70528471AFF9A051.key
state: present
- name: setup balena etcher repo
become: true
when: (dev_full or dev_embedded) and not headless
ansible.builtin.apt_repository:
repo: 'deb https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu jammy main'
state: present
- name: setup balena etcher source repo
become: true
when: (dev_full or dev_embedded) and not headless
ansible.builtin.apt_repository:
repo: 'deb-src https://dl.cloudsmith.io/public/balena/etcher/deb/ubuntu jammy main'
state: present
- name: install balena etcher
become: true
when: (dev_full or dev_embedded) and not headless
ansible.builtin.apt: name=balena-etcher-electron state=present
- name: link etcher to /usr/bin
become: true
when: (dev_full or dev_embedded) and not headless
ansible.builtin.file:
src: /opt/balenaEtcher/balena-etcher-electron
dest: /usr/local/bin/etcher
owner: root
group: root
mode: 0755
state: link