Skip to content

Commit

Permalink
Merge pull request #23 from Oefenweb/consistency-changes
Browse files Browse the repository at this point in the history
Consistency changes
  • Loading branch information
tersmitten authored Jun 6, 2023
2 parents 6310590 + 12e0a28 commit 4cccd95
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
warn_list:
- role-name
- name[play]
- name[casing]
- '306'
- '403'
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install ansible-lint[community,yamllint]
run: |
pip install ansible-lint
ansible-galaxy install -r requirements.yml
- name: Lint code
run: |
Expand All @@ -43,11 +45,8 @@ jobs:
matrix:
include:
- distro: debian8
ansible-version: '<2.10'
- distro: debian9
- distro: debian10
- distro: ubuntu1604
ansible-version: '>=2.9, <2.10'
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
Expand All @@ -66,7 +65,7 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker
run: pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker

- name: Run Molecule tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/../../tests/vars/main.yml"
roles:
- ../../../
2 changes: 1 addition & 1 deletion molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
become: true
tasks:
- name: include tasks
include: "{{ playbook_dir }}/../../tests/tasks/post.yml"
ansible.builtin.import_tasks: "{{ playbook_dir }}/../../tests/tasks/post.yml"
3 changes: 2 additions & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# requirements file
---
collections: []
collections:
- name: community.general
31 changes: 21 additions & 10 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: install dependencies
apt:
ansible.builtin.apt:
name: "{{ nodejs_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
Expand All @@ -13,7 +13,7 @@
- nodejs-install-dependencies

- name: install additional
apt:
ansible.builtin.apt:
name: "{{ nodejs_install }}"
state: "{{ apt_install_state | default('latest') }}"
tags:
Expand All @@ -22,8 +22,8 @@
- nodejs-install
- nodejs-install-additional

- name: add repository and install its signing key # noqa command-instead-of-module
shell: >
- name: add repository and install its signing key # noqa command-instead-of-module risky-shell-pipe
ansible.builtin.shell: >
curl -sL https://deb.nodesource.com/setup_{{ nodejs_version_map[nodejs_version] }} | bash -
args:
creates: /etc/apt/sources.list.d/nodesource.list
Expand All @@ -34,7 +34,7 @@
- nodejs-install-add-repository

- name: install
apt:
ansible.builtin.apt:
name: "{{ 'nodejs' if 'nodejs' in nodejs_version else 'iojs' }}"
state: "{{ apt_install_state | default('latest') }}"
tags:
Expand All @@ -44,13 +44,24 @@
- nodejs-install-install

- name: install node.js packages (globally)
npm:
name: "{{ item.name }}"
version: "{{ item.version | default('latest') }}"
global: true
with_items: "{{ nodejs_npm_packages }}"
tags:
- configuration
- nodejs
- nodejs-npm
- nodejs-npm-install
block:
- name: install node.js packages (specific version)
community.general.npm:
name: "{{ item.name }}"
version: "{{ item.version }}"
global: true
with_items: "{{ nodejs_npm_packages }}"
when: "item.version | default('latest') != 'latest'"

- name: install node.js packages (latest version)
community.general.npm:
name: "{{ item.name }}"
state: "{{ item.version | default('latest') }}"
global: true
with_items: "{{ nodejs_npm_packages }}"
when: "item.version | default('latest') == 'latest'"
10 changes: 5 additions & 5 deletions tests/tasks/post.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# post test file
---
- name: install dependencies
apt:
- name: install dependencies # noqa package-latest
ansible.builtin.apt:
name:
- curl
state: latest
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"

- name: test installation # noqa command-instead-of-module
command: >
- name: test installation # noqa command-instead-of-module risky-shell-pipe
ansible.builtin.command: >
echo 'console.log("PING".replace("I", "O"));'
| nodejs
| grep -q 'PONG'
Expand All @@ -21,7 +21,7 @@
- skip_ansible_lint

- name: run tests
command: >
ansible.builtin.command: >
{{ item }}
changed_when: false
with_items:
Expand Down
6 changes: 3 additions & 3 deletions tests/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml"
roles:
- ../../
post_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/post.yml"
ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/post.yml"
6 changes: 3 additions & 3 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
become: true
pre_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml"
roles:
- ../../
post_tasks:
- name: include vars
include_vars: "{{ playbook_dir }}/vars/main.yml"
ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml"
- name: include tasks
include: "{{ playbook_dir }}/tasks/post.yml"
ansible.builtin.import_tasks: "{{ playbook_dir }}/tasks/post.yml"

0 comments on commit 4cccd95

Please sign in to comment.