Skip to content

Commit

Permalink
Merge pull request #45 from fubarhouse/new-platform-support
Browse files Browse the repository at this point in the history
Feature/support PR from new-platform-support
  • Loading branch information
fubarhouse authored Aug 12, 2017
2 parents c8acd23 + 6efca14 commit f1f5c46
Show file tree
Hide file tree
Showing 12 changed files with 283 additions and 138 deletions.
113 changes: 87 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,129 @@
services: docker

env:
- distro: ubuntu1604
- docker_user: geerlingguy
distro: ubuntu1204
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
playbook_indepotence: test-idempotence.yml
- distro: ubuntu1404
- docker_user: fubarhouse
distro: ubuntu1210
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
playbook_indepotence: test-idempotence.yml
- distro: ubuntu1204
- docker_user: fubarhouse
distro: ubuntu1304
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
playbook_indepotence: test-idempotence.yml
- distro: centos6
- docker_user: fubarhouse
distro: ubuntu1310
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: geerlingguy
distro: ubuntu1404
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: fubarhouse
distro: ubuntu1410
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: fubarhouse
distro: ubuntu1504
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: fubarhouse
distro: ubuntu1510
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: geerlingguy
distro: ubuntu1604
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: fubarhouse
distro: ubuntu1610
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: fubarhouse
distro: ubuntu1704
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: fubarhouse
distro: ubuntu1710
init: /sbin/init
run_opts: "--privileged"
playbook: test.yml
- docker_user: geerlingguy
distro: centos6
init: "/sbin/init"
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml
playbook_indepotence: test-idempotence.yml
- distro: centos7
- docker_user: geerlingguy
distro: centos7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml
playbook_indepotence: test-idempotence.yml
- distro: debian8
- docker_user: fubarhouse
distro: debian7
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml
- docker_user: geerlingguy
distro: debian8
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml
- docker_user: fubarhouse
distro: debian9
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml
playbook_indepotence: test-idempotence.yml
# - distro: fedora24
# init: /usr/lib/systemd/systemd
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
# playbook: test.yml
# playbook_indepotence: test-idempotence.yml
- docker_user: fubarhouse
distro: fedora24
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml
- docker_user: fubarhouse
distro: fedora25
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml
- docker_user: fubarhouse
distro: fedora26
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml

before_install:

# Pull container.
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'
- 'docker pull ${docker_user}/docker-${distro}-ansible:latest'

script:

- container_id=$(mktemp)
# Run container in detached state.
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'

# Install dependencies.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-galaxy install geerlingguy.git'
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-galaxy install fubarhouse.curl'
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${docker_user}/docker-${distro}-ansible:latest "${init}" > "${container_id}"'

# Ansible syntax check.
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check -vvvv'
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} --syntax-check'

# Test role.
- 'docker exec "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
- 'docker exec "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}'

# Test role idempotence.
- idempotence=$(mktemp)
- >
docker exec "$(cat ${container_id})"
ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook_indepotence} --sudo -vvvv
ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} --sudo
| tee -a ${idempotence}
- >
tail ${idempotence}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ node_version: 3.0.0
node_versions:
- 1.0.0
- 2.0.0
````

## Dependencies

None.
Expand Down
8 changes: 5 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@ shell_profiles:
- .bash_profile
nodejs_clean_install: false
nvm_symlink_exec: /usr/local/bin/nvm
nvm_version: v0.33.2

nvm_repo: "https://github.com/xtuple/nvm.git"
#nvm_repo: "https://github.com/xtuple/nvm.git"
ivm_repo: "https://github.com/demohi/ivm.git"

install_nvm: true
install_nvm_git: true
install_nodejs: true
install_ivm: false
install_iojs: false
install_npm: true

node_version: 7.9.0
node_version: 8.3.0
node_versions:
- 4.8.2
- 5.12.0
- 6.10.2
- 6.11.2
- 7.9.0

node_packages:
Expand Down
32 changes: 24 additions & 8 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,34 @@ galaxy_info:
license: "license (BSD, MIT)"
min_ansible_version: 2.1.0.0
platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial
- name: Debian
versions:
- all
- wheezy
- jessie
- stretch
- name: EL
versions:
- 6
- 7
- 6
- 7
- name: Fedora
versions:
- 24
- 25
- 26
- name: Ubuntu
versions:
- artful
- zesty
- yakkety
- xenial
- vivid
- wily
- utopic
- trusty
- saucy
- raring
- quantal
- precise
categories:
- system
- database
Expand Down
14 changes: 6 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
# Main tasks file for fubarhouse.nodejs

- include: setup.yml

- name: "Define user variable for ssh use"
set_fact:
fubarhouse_user: "{{ ansible_ssh_user }}"
Expand Down Expand Up @@ -42,17 +44,13 @@
when: install_nvm

- include: ivm.yml
when:
- install_ivm == true
- '"{{ ansible_os_family }}" != "Darwin"'
when: install_ivm|bool == true

- include: nodejs.yml
when: install_nodejs == true
when: install_nodejs|bool == true

- include: iojs.yml
when:
- install_iojs == true
- '"{{ ansible_os_family }}" != "Darwin"'
when: install_iojs|bool == true

- include: npm.yml
when: install_npm == true
when: install_npm|bool == true
4 changes: 2 additions & 2 deletions tasks/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- name: "NodeJS | Switching"
become: yes
become_user: "{{ fubarhouse_user }}"
shell: "{{ nvm_symlink_exec }} use {{ node_version }}"
shell: "{{ nvm_symlink_exec }} use --delete-prefix {{ node_version }}"
register: fubarhouse_npm_switch
changed_when: false
when: '"{{ node_version }}" in nodejs_available_versions.stdout'
Expand Down Expand Up @@ -56,7 +56,7 @@
when: item.item.stat.exists|bool == true

- name: "NodeJS | Verify version in use"
shell: "{{ nvm_symlink_exec }} ls | grep current | cat"
shell: "{{ nvm_symlink_exec }} current"
register: node_current_version
changed_when: false
failed_when: 'node_current_version.stdout.find("{{ node_version }}") == -1'
Expand Down
9 changes: 0 additions & 9 deletions tasks/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
changed_when: false
register: which_npm

- name: "NPM | Configure"
become: yes
become_user: "{{ fubarhouse_user }}"
shell: "{{ which_npm.stdout }} config set prefix /usr/local"
when: '"npm" in "{{ which_npm.stdout }}"'
changed_when: false
failed_when: false
when: '"npm" in which_npm.stdout'

- name: "NPM | Ensure installed and updated"
become: yes
become_user: root
Expand Down
Loading

0 comments on commit f1f5c46

Please sign in to comment.