├── .gitignore ├── handlers └── main.yml ├── files └── esp8266.sh ├── vars └── main.yml ├── meta └── main.yml ├── Dockerfile ├── playbook.yml ├── LICENSE ├── README.md └── tasks └── main.yml /.gitignore: -------------------------------------------------------------------------------- 1 | playbook-local.yml 2 | inventory-local 3 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for esp8266 3 | -------------------------------------------------------------------------------- /files/esp8266.sh: -------------------------------------------------------------------------------- 1 | export PATH=/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/bin:$PATH 2 | -------------------------------------------------------------------------------- /vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | deploy_user: "ubuntu" 3 | esp_iot_sdk_archive_url: "http://bbs.espressif.com/download/file.php?id=838" 4 | esp_iot_sdk: "esp_iot_sdk_v1.4.0_15_09_18" 5 | esp_iot_sdk_path: "esp_iot_sdk_v1.4.0" 6 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: Mark Wolfe 4 | description: esp8266 development role for OSX and Linux 5 | license: MIT 6 | categories: 7 | - development 8 | min_ansible_version: 1.2 9 | dependencies: [] 10 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM williamyeh/ansible:ubuntu14.04-onbuild 2 | 3 | # ==> Specify playbook filename; default = "playbook.yml" 4 | #ENV PLAYBOOK playbook.yml 5 | 6 | # ==> Specify inventory filename; default = "/etc/ansible/hosts" 7 | #ENV INVENTORY inventory.ini 8 | 9 | # ==> Executing Ansible... 10 | RUN ansible-playbook-wrapper --verbose 11 | -------------------------------------------------------------------------------- /playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Test the esp8266 role 3 | hosts: all 4 | sudo: yes 5 | tasks: 6 | - name: Add ubuntu user 7 | user: name=ubuntu 8 | - name: Generate locales 9 | shell: locale-gen en_US en_US.UTF-8 10 | - name: Update locale 11 | shell: /usr/sbin/update-locale LANG=en_US LC_ALL=en_US.UTF-8 12 | - include: "tasks/main.yml" 13 | vars: 14 | deploy_user: ubuntu 15 | esp_iot_sdk_archive_url: "http://bbs.espressif.com/download/file.php?id=838" 16 | esp_iot_sdk: "esp_iot_sdk_v1.4.0_15_09_18" 17 | esp_iot_sdk_path: "esp_iot_sdk_v1.4.0" 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Mark Wolfe 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # esp8266 2 | 3 | This role installs all the esp8266 development environment. 4 | 5 | ## Example 6 | 7 | Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: 8 | 9 | - hosts: servers 10 | roles: 11 | - { role: wolfeidau.esp8266, deploy_user: "markw" } 12 | 13 | # Using Ansible 14 | 15 | TODO 16 | 17 | # Docker 18 | 19 | This is also used to produce a docker container with this environment packed inside to make it easy for others to get building with esp8266! 20 | 21 | To release a new version run the following commands: 22 | 23 | docker build -t wolfeidau/esp8266-dev:1.1.0 24 | docker tag -f wolfeidau/esp8266-dev:1.1.0 wolfeidau/esp8266-dev:latest 25 | docker push wolfeidau/esp8266-dev:1.1.0 26 | docker push wolfeidau/esp8266-dev:latest 27 | 28 | # License 29 | 30 | This code is Copyright (c) 2014 Mark Wolfe and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. 31 | 32 | # Author Information 33 | ------------------ 34 | 35 | Mark Wolfe 36 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: make base directory 3 | file: 4 | path: /opt/Espressif/downloads 5 | recurse: yes 6 | state: directory 7 | mode: 0755 8 | owner: "{{ deploy_user }}" 9 | 10 | - name: install build dependencies 11 | apt: pkg={{ item }} update_cache=true 12 | with_items: 13 | - git 14 | - autoconf 15 | - build-essential 16 | - gperf 17 | - bison 18 | - flex 19 | - texinfo 20 | - libtool 21 | - libncurses5-dev 22 | - wget 23 | - gawk 24 | - libc6-dev 25 | - python-serial 26 | - libexpat-dev 27 | - unzip 28 | 29 | - name: Check if crosstool-NG exists 30 | stat: path=/opt/Espressif/crosstool-NG 31 | register: check_crosstool 32 | 33 | - name: clone crosstool-NG 34 | git: 35 | repo: git://github.com/jcmvbkbc/crosstool-NG.git 36 | dest: /opt/Espressif/crosstool-NG 37 | depth: 1 38 | version: lx106 39 | accept_hostkey: True 40 | sudo_user: "{{ deploy_user }}" 41 | environment: 42 | HOME: "/home/{{ deploy_user }}" 43 | when: not check_crosstool.stat.exists 44 | 45 | - name: bootstrap crosstool-NG 46 | shell: /opt/Espressif/crosstool-NG/bootstrap chdir=/opt/Espressif/crosstool-NG 47 | sudo_user: "{{ deploy_user }}" 48 | when: not check_crosstool.stat.exists 49 | 50 | - name: configure crosstool-NG 51 | shell: ./configure --prefix=`pwd` chdir=/opt/Espressif/crosstool-NG 52 | sudo_user: "{{ deploy_user }}" 53 | when: not check_crosstool.stat.exists 54 | 55 | - name: make crosstool-NG 56 | shell: make chdir=/opt/Espressif/crosstool-NG 57 | sudo_user: "{{ deploy_user }}" 58 | when: not check_crosstool.stat.exists 59 | 60 | - name: make install crosstool-NG 61 | shell: make install chdir=/opt/Espressif/crosstool-NG 62 | sudo_user: "{{ deploy_user }}" 63 | when: not check_crosstool.stat.exists 64 | 65 | - name: run ct-ng xtensa-lx106-elf 66 | shell: /opt/Espressif/crosstool-NG/ct-ng xtensa-lx106-elf chdir=/opt/Espressif/crosstool-NG 67 | sudo_user: "{{ deploy_user }}" 68 | when: not check_crosstool.stat.exists 69 | 70 | - name: run ct-ng xtensa-lx106-elf build 71 | shell: /opt/Espressif/crosstool-NG/ct-ng build chdir=/opt/Espressif/crosstool-NG creates=/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf 72 | sudo_user: "{{ deploy_user }}" 73 | when: not check_crosstool.stat.exists 74 | 75 | - name: ct-ng cleanup 76 | shell: rm -rf /opt/Espressif/crosstool-NG/.build removes=/opt/Espressif/crosstool-NG/.build 77 | sudo_user: "{{ deploy_user }}" 78 | when: not check_crosstool.stat.exists 79 | 80 | - name: update profile.d 81 | copy: src=esp8266.sh dest=/etc/profile.d/esp8266.sh mode=644 82 | 83 | - name: gets sdk archive 84 | get_url: url="{{ esp_iot_sdk_archive_url }}" dest="/opt/Espressif/downloads/{{ esp_iot_sdk }}.zip" 85 | sudo_user: "{{ deploy_user }}" 86 | register: new_sdk_archive 87 | 88 | - name: unarchive source 89 | shell: unzip -o "/opt/Espressif/downloads/{{ esp_iot_sdk }}.zip" -d "/opt/Espressif" 90 | sudo_user: "{{ deploy_user }}" 91 | when: new_sdk_archive|changed 92 | 93 | - name: link SDK 94 | file: src=/opt/Espressif/{{ esp_iot_sdk_path }} dest="/opt/Espressif/ESP8266_SDK" state=link 95 | when: new_sdk_archive|changed 96 | 97 | - name: gets libc.a 98 | get_url: url="https://github.com/esp8266/esp8266-wiki/raw/master/libs/libc.a" dest="/opt/Espressif/ESP8266_SDK/lib/libc.a" 99 | sudo_user: "{{ deploy_user }}" 100 | when: new_sdk_archive|changed 101 | 102 | - name: gets libhal.a 103 | get_url: url="https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a" dest="/opt/Espressif/ESP8266_SDK/lib/libhal.a" 104 | sudo_user: "{{ deploy_user }}" 105 | when: new_sdk_archive|changed 106 | 107 | - name: Gets includes tarball 108 | get_url: url="https://github.com/esp8266/esp8266-wiki/raw/master/include.tgz" dest="/opt/Espressif/downloads/" 109 | sudo_user: "{{ deploy_user }}" 110 | 111 | - name: Unarchive includes source 112 | unarchive: src="/opt/Espressif/downloads/include.tgz" dest="/opt/Espressif/ESP8266_SDK" copy=no 113 | sudo_user: "{{ deploy_user }}" 114 | when: new_sdk_archive|changed 115 | 116 | - name: clone esptool 117 | git: 118 | repo: https://github.com/igrr/esptool-ck 119 | dest: /opt/Espressif/esptool-ck 120 | accept_hostkey: True 121 | sudo_user: "{{ deploy_user }}" 122 | 123 | - name: make esptool 124 | shell: make chdir=/opt/Espressif/esptool-ck 125 | sudo_user: "{{ deploy_user }}" 126 | 127 | - name: link the esptool into bin directory 128 | file: src=/opt/Espressif/esptool-ck/esptool dest="/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/bin/esptool" state=link 129 | 130 | --------------------------------------------------------------------------------