Install Meteor via Ansible?


#1

Does anyone have a good method to install Meteor via Ansible?

Ansible Galaxy’s official Meteor package has:

- name: meteor | verify if meteor is already installed
  command: meteor --version
  ignore_errors: yes
  register: mtr_version
  changed_when: mtr_version.rc != 0 or mtr_version.stdout != "Meteor {{ meteor_version }}"
  always_run: yes

- name: get meteor installer
  get_url:
    url=https://install.meteor.com/
    dest=/tmp/meteor.sh
    mode=0440
  when: mtr_version.changed and mtr_version.rc != 0

- name: Install meteor
  command: /bin/sh /tmp/meteor.sh
  when: mtr_version.changed and mtr_version.rc != 0

- name: Update Meteor
  command: "meteor update --release {{ meteor_version }}"
  when: mtr_version.rc == 0 and mtr_version.changed and mtr_version.stdout != "Meteor {{ meteor_version }}"

That doesn’t work for me on Ubuntu 17.10.

If I try downloading the tarbell file, then manually unzipping and running the install script, it runs, but with errors, and then Meteor doesn’t work right.

If no one has a handy Meteor Ansible script, just instructions on manual installation would help. Read through the .sh install file a few times but I must be missing something.


#2

For those who are interested, I got it working by uploading the meteor.sh install script.

- name: Verify if Meteor is already installed
  stat:
    path: /usr/local/bin/meteor
  register: meteor_exist
  become_user: "{{ meteor_owner }}"

- name: Upload Meteor install script
  copy:
    src: "{{ playbook_dir }}/meteor.sh"
    dest: "{{ install_dir }}"
  when: meteor_exist.stat.exists == False

- name: Run Meteor install script
  shell: sh {{ install_dir}}/meteor.sh
  when: meteor_exist.stat.exists == False

I’m sure there are more elegant ways to do this – if so, please let me know.