diff --git a/README.md b/README.md new file mode 100644 index 0000000..448a31d --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +Ansible role: DevkitPro +========= + +An Ansible Role that installs Devkitpro and devkit tools on Debian/Ubuntu/Pop_Os!. + +Requirements +------------ + +None. + +Role Variables +-------------- + +Available variables are listed below, along with default values (see defaults/main.yml): + +``` +platforms_enabled: + - gp2x + # - gp32 + # - gba + # - nds + # - 3ds + # - gamecube + # - wii + # - wiiu + # - switch +``` +Depending on the devkit you'd like to install, add or remove lines containing your desired platforms without the suffix "-dev". + +See [on the official doc](https://devkitpro.org/wiki/devkitPro_pacman#Using_Pacman) which platforms are supported. + + +Dependencies +------------ + +None. + + +Example Playbook +---------------- + +``` +- hosts: all + vars_files: + - vars/main.yml + roles: + - { role: dag7dev.devkitpro } +``` + +Inside vars/main.yml: +``` +platforms_enabled: + - gba + - nds +``` + + +License +------- + +MIT / BSD + + +Author Information +------------------ + +This role was created in 2023 by Damiano Gualandri, author of [awesome stuff](github.com/dag7dev). \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..ede9bb6 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,12 @@ +--- +# defaults file for devkitpro-nds +platforms_enabled: + - gp2x + # - gp32 + # - gba + # - nds + # - 3ds + # - gamecube + # - wii + # - wiiu + # - switch \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..48d4175 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for devkitpro diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..d81b2ee --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,27 @@ +galaxy_info: + author: dag7 + company: "Dag7 Inc." + description: Devkitpro for Linux. + role_name: devkitpro + license: license (BSD, MIT) + + min_ansible_version: 2.10 + platforms: + - name: Amazon + versions: + - all + - name: Debian + versions: + - all + - name: Ubuntu + versions: + - bionic + - jammy + + + galaxy_tags: + - devkit + - homebrew + - console + +allow_duplicates: true \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..82d6cbb --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,67 @@ +--- +# tasks file for devkitpro +- name: Install ca-certificates + apt: + update_cache: yes + state: latest + name: + - "ca-certificates" + +- name: Check if pip3 command exists + command: "which pip3" + register: pip3_command_check + ignore_errors: true + +- name: Install pip + apt: + name: + - python3-pip + when: pip3_command_check.rc != 0 + +- name: Install pexpect + pip: + name: pexpect + +- name: Print devkit platforms enabled + ansible.builtin.debug: + msg: Platforms enabled {{ platforms_enabled }} + +- name: Check if dkp-pacman command exists + command: "which dkp-pacman" + register: command_check + ignore_errors: true + +- name: Create /tmp directory + file: + path: /tmp + state: directory + when: command_check.rc != 0 + +- name: Get installation script + get_url: + url: https://apt.devkitpro.org/install-devkitpro-pacman + dest: /tmp/install-devkitpro-pacman + mode: '+x' + when: command_check.rc != 0 + +- name: Install devkitpro-pacman + shell: yes | /tmp/install-devkitpro-pacman + when: command_check.rc != 0 + +- name: Check if dkp-pacman command exists + command: "which dkp-pacman" + register: command_check + ignore_errors: true + +- name: Update dkp-pacman packages + shell: yes | + when: command_check.rc == 0 + +- name: Install specified platform devkit {{ item }} + expect: + command: dkp-pacman -S --noconfirm {{ item }}-dev + responses: + ".*default*": "all\r" + ".*[Y/n].*": "Y\r" + loop: "{{ platforms_enabled }}" + when: command_check.rc == 0 diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..4def343 --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - devkitpro diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..19a6934 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for devkitpro