diff --git a/.travis.yml b/.travis.yml index ee0e314..d2f9018 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,48 +1,31 @@ --- language: python -python: "2.7" +services: docker -# Use the new container infrastructure -sudo: false - -# Install ansible -addons: - apt: - packages: - - python-pip +env: + global: + - ROLE_NAME: snmp + matrix: + - MOLECULE_DISTRO: centos6 + - MOLECULE_DISTRO: debian10 install: - # Install ansible - - pip install ansible - - # Install ansible-lint - - pip install ansible-lint - - # Install yamllint - - pip install yamllint - - # Install tests rules - - git submodule add https://github.com/arillso/tests tests + - pip install docker molecule yamllint ansible-lint flake8 + - git clone https://github.com/arillso/tests molecule/default/lint before_script: - # Check ansible version - - ansible --version - - # Check ansible-lint version - - ansible-lint --version - - # Check ansible-lint version - - yamllint --version + - cd ../ + - mv ansible.$ROLE_NAME sbaerlocher.$ROLE_NAME + - cd sbaerlocher.$ROLE_NAME script: - # Ansible Lint check - - ansible-lint -R -r tests/ansible-lint/ . - - # YAML Lint check - - yamllint -c tests/yaml-lint/yamllint.yml . + - molecule test notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ + webhooks: + urls: + - https://galaxy.ansible.com/api/v1/notifications/ + on_success: always email: on_success: never on_failure: always diff --git a/README.md b/README.md index 74081f8..1fafda8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Ansible Role: SNMP -[![Build Status](https://img.shields.io/travis/sbaerlocher/ansible.snmp.svg?branch=master&style=popout-square)](https://travis-ci.org/sbaerlocher/ansible.snmp) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=popout-square)](https://sbaerlo.ch/licence) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-snmp-blue.svg?style=popout-square)](https://galaxy.ansible.com/sbaerlocher/snmp) [![Ansible Role](https://img.shields.io/ansible/role/d/9234.svg?style=popout-square)](https://galaxy.ansible.com/sbaerlocher/snmp) +[![Build Status](https://img.shields.io/travis/sbaerlocher/ansible.snmp.svg?branch=master&style=popout-square)](https://travis-ci.org/sbaerlocher/ansible.snmp) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?style=popout-square)](https://sbaerlo.ch/licence) [![Ansible Galaxy](https://img.shields.io/badge/ansible--galaxy-snmp-blue.svg?style=popout-square)](https://galaxy.ansible.com/sbaerlocher/snmp) [![Ansible Role](https://img.shields.io/ansible/role/d/9234.svg?style=popout-square)](https://galaxy.ansible.com/sbaerlocher/snmp) ## Description @@ -16,16 +16,16 @@ ansible-galaxy install sbaerlocher.snmp ## Role Variables -| Variable | Default | Comments (type) | -| :--- | :--- | :--- | -| snmp_user | snmp | SNMP User | -| snmp_password | snmp_password | SNMP Password | -| snmp_encryption | snmp_encryption | SNMP Encryption | -| snmp_contact | | Optional: System Contact | -| snmp_location | | Optional: System Location | -| snmp_agentadress_protocol.ipvX | udp / udp6 | Optional: SNMP Protocol, X for ipv4 or ipv6 -| snmp_agentadress_adress.ipvX | {{ ansible_default_ipv4.address }} / {{ ansible_default_ipv6.address }} | Optional: SNMP bind address, X for ipv4 or ipv6 | -| snmp_agentadress_port.ipvX | 161 / 161 | Optional: SNMP port, X for ipv4 or ipv6 | +| Variable | Default | Comments (type) | +| :----------------------------- | :---------------------------------------------------------------------- | :---------------------------------------------- | +| snmp_user | snmp | SNMP User | +| snmp_password | snmp_password | SNMP Password | +| snmp_encryption | snmp_encryption | SNMP Encryption | +| snmp_contact | | Optional: System Contact | +| snmp_location | | Optional: System Location | +| snmp_agentadress_protocol.ipvX | udp / udp6 | Optional: SNMP Protocol, X for ipv4 or ipv6 | +| snmp_agentadress_adress.ipvX | {{ ansible_default_ipv4.address }} / {{ ansible_default_ipv6.address }} | Optional: SNMP bind address, X for ipv4 or ipv6 | +| snmp_agentadress_port.ipvX | 161 / 161 | Optional: SNMP port, X for ipv4 or ipv6 | ## Dependencies @@ -36,56 +36,60 @@ None ```yml - hosts: all roles: - - sbaerlocher.snmp + - sbaerlocher.snmp ``` ## Changelog +### 1.8.0 + +- add snmp install via module + ### 1.7.1 -* add support for Windows 1809 +- add support for Windows 1809 ### 1.7.0 -* add osupdate support -* syntax cleaned up +- add osupdate support +- syntax cleaned up ### 1.6.0 -* add distro support -* syntax cleaned up -* proxmox support +- add distro support +- syntax cleaned up +- proxmox support ### 1.5 -* add Windows Support +- add Windows Support ### 1.4 -* add IP bind support +- add IP bind support ### 1.3 -* add become support -* new role check -* support for sysContact and sysLocation +- add become support +- new role check +- support for sysContact and sysLocation ### 1.2 -* add package manager for generic OS -* cleanup +- add package manager for generic OS +- cleanup ### 1.1 -* add ArchLinux support +- add ArchLinux support ### 1.0 -* Initial release +- Initial release ## Author -* [Simon Bärlocher](https://sbaerlocher.ch) +- [Simon Bärlocher](https://sbaerlocher.ch) ## License diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..6a15a77 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,27 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: | + set -e + yamllint . -c molecule/default/yamllint.yml +platforms: + - name: instance + image: 'geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest' + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro + privileged: true + pre_build_image: true +provisioner: + name: ansible + lint: + name: ansible-lint + playbooks: + converge: ${MOLECULE_PLAYBOOK:-playbook.yml} +scenario: + name: default +verifier: + name: testinfra + lint: + name: flake8 diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml new file mode 100644 index 0000000..a1aee98 --- /dev/null +++ b/molecule/default/playbook.yml @@ -0,0 +1,5 @@ +--- +- name: Converge + hosts: all + roles: + - role: sbaerlocher.snmp diff --git a/molecule/default/yamllint.yml b/molecule/default/yamllint.yml new file mode 100644 index 0000000..4978971 --- /dev/null +++ b/molecule/default/yamllint.yml @@ -0,0 +1,5 @@ +--- +extends: default +rules: + line-length: disable + comments: disable diff --git a/tasks/distribution/Microsoft Windows 10 Pro-10.0.17763.0.yml b/tasks/distribution/Microsoft Windows 10 Pro.yml similarity index 64% rename from tasks/distribution/Microsoft Windows 10 Pro-10.0.17763.0.yml rename to tasks/distribution/Microsoft Windows 10 Pro.yml index 1de095e..c70c35b 100644 --- a/tasks/distribution/Microsoft Windows 10 Pro-10.0.17763.0.yml +++ b/tasks/distribution/Microsoft Windows 10 Pro.yml @@ -1,25 +1,12 @@ --- # tasks file for sbaerlocher.snmp -# https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.Servicing::Servicing -# https://www.zueschen.eu/windows-10-version-1809-rsat-tools-installation-schlaegt-fehl/ -- name: 'windows : Specify settings for optional component installation and component repair' - win_regedit: - path: 'HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Servicing' - name: '{{ item.name }}' - type: '{{ item.type }}' - data: '{{ item.data }}' - state: absent - with_items: - - name: 'RepairContentServerSource' - type: 'dword' - data: '2' - - name: 'LocalSourcePath' - type: 'expandstring' - data: '' - -# - name: 'windows : install SNMP' -# win_shell: Add-WindowsCapability -Online -Name 'SNMP.Client~~~~0.0.1.0' +- name: 'Windows : Install SNMP Client' + become_method: runas + become_user: System + become: yes + sbaerlocher.windows.win_capability: + name: 'SNMP.Client~~~~0.0.1.0' - name: 'windows : setting SNMP' win_regedit: @@ -44,8 +31,8 @@ name: '{{ snmp_community | default() }}' type: dword data: '4' -# notify: -# - restart win snmp + notify: + - restart win snmp - name: 'windows : set remote IP-Adresss' set_fact: