--- - name: Bring up Docker containers hosts: localhost gather_facts: false vars: inventory: - name: ubuntu_latest image: "ubuntu:latest" - name: ubuntu_xenial image: "ubuntu:xenial" - name: ubuntu_trusty image: "ubuntu:trusty" - name: debian_testing image: "debian:testing" - name: debian_stable image: "debian:stable" - name: debian_oldstable image: "debian:oldstable" roles: - role: provision_docker provision_docker_inventory: "{{ inventory }}" provision_docker_privileged: true provision_docker_use_docker_connection: true - name: Test role hosts: docker_containers gather_facts: false pre_tasks: - name: Provision Python raw: bash -c "test -e /usr/bin/python || (apt-get -y update && apt-get install -y python-simplejson)" register: output changed_when: output.stdout - setup: # Gather facts vars: unattended_autofix_interrupted_dpkg: false unattended_minimal_steps: true unattended_install_on_shutdown: true unattended_automatic_reboot: true unattended_update_days: '{"Sat"}' roles: # Searched for in ../.. (see ansible.cfg) - ansible-role-unattended-upgrades tasks: - name: Idempotency check include_role: name: ansible-role-unattended-upgrades register: idempotency - fail: msg: Role failed idempotency check when: idempotency.changed - name: Get apt-config variables shell: apt-config dump register: aptconfig - name: Check for registered variables assert: that: item in aptconfig.stdout with_items: - 'APT::Periodic::Unattended-Upgrade "1"' - 'Unattended-Upgrade::AutoFixInterruptedDpkg "false"' - 'Unattended-Upgrade::MinimalSteps "true"' - 'Unattended-Upgrade::InstallOnShutdown "true"' - 'Unattended-Upgrade::Automatic-Reboot "true"' # NOTE: this uses the array syntax, which requires one # top-level record, then one item per line - 'Unattended-Upgrade::Update-Days "";' - 'Unattended-Upgrade::Update-Days:: "Sat";' - name: Dry run unattended-upgrades command: /usr/bin/unattended-upgrades --dry-run