Skip to content
Snippets Groups Projects
Commit 71e29723 authored by nimrod's avatar nimrod
Browse files

Merge branch 'master' of /home/nimrod/Documents/Shore/Ansible/example

# Conflicts:
#	README.rst
#	defaults/main.yml
#	handlers/main.yml
#	molecule.yml
#	tasks/main.yml
#	tests/playbook.yml
#	tests/requirements.yml
#	vars/main.yml
parents c2ce77df 46ba6ecd
Branches
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
- id: check-merge-conflict - id: check-merge-conflict
- id: flake8 - id: flake8
- id: check-symlinks - id: check-symlinks
- repo: https://www.shore.co.il/git/ansible-pre-commit - repo: https://github.com/adarnimrod/ansible-pre-commit.git
sha: 0fadd691465b97db8992cfc66650f630e433324b sha: 0fadd691465b97db8992cfc66650f630e433324b
hooks: hooks:
- id: ansible-syntax-check - id: ansible-syntax-check
......
---
language: python
python: "2.7"
dist: trusty
sudo: false
group: beta
services: [docker]
cache:
- pip
- directories:
- $HOME/.pre-commit
install:
- pip install -r tests/requirements.txt | cat
- ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
- molecule dependency
script:
- pre-commit run --all-files
- molecule test --driver docker
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
email: false
Unattended upgrades Unattended upgrades
################### ###################
An Ansible role to configure unattended upgrades on Debian based distros. .. image:: https://travis-ci.org/adarnimrod/unattended-upgrades.svg?branch=master
:target: https://travis-ci.org/adarnimrod/unattended-upgrades
Configure unattended upgrades on Debian based distros.
Requirements Requirements
------------ ------------
See :code:`meta/main.yml`, :code:`tests/requirements.yml` and assertions at See :code:`meta/main.yml` and assertions at the top of :code:`tasks/main.yml`.
the top of :code:`tasks/main.yml`.
Role Variables Role Variables
-------------- --------------
...@@ -27,21 +29,22 @@ See :code:`tests/playbook.yml`. ...@@ -27,21 +29,22 @@ See :code:`tests/playbook.yml`.
Testing Testing
------- -------
Testing requires Virtualbox and Vagrant and Python 2.7. Install the Python Testing requires Python 2.7 and either Docker or Vagrant and Virtualbox.
dependencies, add pre-commit hooks by running: Install the Python dependencies, dependent roles and roles required for
testing:
.. code:: shell .. code:: shell
pip install -r tests/requirements.txt pip install -r tests/requirements.txt
pre-commit install ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
molecule dependency
To run the full test suite: To run the full test suite:
.. code:: shell .. code:: shell
ansible-galaxy install git+file://$(pwd),$(git rev-parse --abbrev-ref HEAD) -p .molecule/roles
molecule test --platform all
pre-commit run --all-files pre-commit run --all-files
molecule test --platform all
License License
------- -------
......
...@@ -5,6 +5,7 @@ retry_files_enabled = False ...@@ -5,6 +5,7 @@ retry_files_enabled = False
roles_path = .molecule/roles:.molecule/../roles:../:../../ roles_path = .molecule/roles:.molecule/../roles:../:../../
command_warnings = True command_warnings = True
deprecation_warnings = True deprecation_warnings = True
callback_whitelist = profile_tasks
[ssh_connection] [ssh_connection]
pipelining = True pipelining = True
...@@ -8,5 +8,9 @@ galaxy_info: ...@@ -8,5 +8,9 @@ galaxy_info:
- name: Debian - name: Debian
versions: versions:
- jessie - jessie
- name: Ubuntu
versions:
- trusty
- xenial
galaxy_tags: [ debian ] galaxy_tags: [ debian ]
dependencies: [] dependencies: []
...@@ -5,6 +5,10 @@ ansible: ...@@ -5,6 +5,10 @@ ansible:
diff: True diff: True
config_file: ../ansible.cfg config_file: ../ansible.cfg
dependency:
name: galaxy
requirements_file: tests/requirements.yml
vagrant: vagrant:
providers: providers:
- name: virtualbox - name: virtualbox
...@@ -12,6 +16,10 @@ vagrant: ...@@ -12,6 +16,10 @@ vagrant:
platforms: platforms:
- name: jessie - name: jessie
box: debian/jessie64 box: debian/jessie64
- name: xenial
box: ubuntu/xenial64
- name: trusty
box: ubuntu/trusty64
instances: instances:
- name: unattended-upgrades - name: unattended-upgrades
options: options:
...@@ -21,3 +29,36 @@ vagrant: ...@@ -21,3 +29,36 @@ vagrant:
- 'vbguest.auto_update = false' - 'vbguest.auto_update = false'
- 'landrush.enabled = false' - 'landrush.enabled = false'
- 'landrush_ip.override = false' - 'landrush_ip.override = false'
docker:
containers:
- name: unattended-upgrades-xenial
image: ubuntu
image_version: xenial
command: /sbin/init
privileged: True
volume_mounts:
- /sys/fs/cgroup:/sys/fs/cgroup
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
environment:
DEBIAN_FRONTEND: noninteractive
container: docker
- name: unattended-upgrades-jessie
image: debian
image_version: jessie
command: /sbin/init
privileged: True
volume_mounts:
- /sys/fs/cgroup:/sys/fs/cgroup
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
environment:
DEBIAN_FRONTEND: noninteractive
container: docker
- name: unattended-upgrades-trusty
image: ubuntu-upstart
image_version: trusty
command: /sbin/init
privileged: True
environment:
DEBIAN_FRONTEND: noninteractive
container: docker
--- ---
# tasks file for unattended-upgrades # tasks file for unattended-upgrades
- name: Assertions - name: Assertions
assert: assert:
that: ansible_pkg_mgr == 'apt' that: ansible_pkg_mgr == 'apt'
......
--- ---
- hosts: unattended-upgrades-openbsd
gather_facts: false
roles: [adarnimrod.openbsd-bootstrap]
- hosts: unattended-upgrades-xenial
gather_facts: false
roles: [adarnimrod.debian-bootstrap]
- hosts: all - hosts: all
strategy: free
roles: roles:
- role: unattended-upgrades - role: unattended-upgrades
ansible==2.2.0.0 ansible==2.2.0.0
testinfra==1.4.3 testinfra==1.4.5
molecule==1.13.0 molecule==1.16.1
ansible-lint==3.4.4 ansible-lint==3.4.7
pre-commit==0.9.3 pre-commit==0.9.4
piprot==0.9.7 piprot==0.9.7
python-vagrant==0.5.14
docker-py==1.10.6
--- ---
- src: https://www.shore.co.il/git/openbsd-bootstrap - src: adarnimrod.openbsd-bootstrap
scm: git - src: adarnimrod.debian-bootstrap
name: openbsd_bootstrap
- src: https://www.shore.co.il/git/debian-bootstrap
scm: git
name: debian_bootstrap
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner('.molecule/ansible_inventory').get_hosts('all')
def test_example(Command): def test_example(Command):
assert Command('uname').rc == 0 assert Command('uname').rc == 0
def test_root(Command, Sudo): def test_root(Command, Sudo):
with Sudo(): with Sudo():
assert Command('whoami').stdout == 'root' assert Command('whoami').stdout.strip() == 'root'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment