Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Voronenko committed Feb 19, 2017
0 parents commit 10d37b2
Show file tree
Hide file tree
Showing 28 changed files with 652 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
box-example/roles
*.retry
54 changes: 54 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
sudo: required

env:
- distribution: ubuntu
version: 14.04
init: /sbin/init
run_opts: ""
playbook: test.yml
- distribution: ubuntu
version: 16.04
init: /sbin/init
run_opts: ""
playbook: test.yml


# whitelist
branches:
only:
- master
- develop

services:
- docker

before_install:
# Pull container
- 'sudo docker pull ${distribution}:${version}'
# Customize container
- 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'

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

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

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

# Test role idempotence.
- >
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}
| grep -q 'unreachable=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Clean up
- sudo docker stop "$(cat ${container_id})"

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) role contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
sa-secure-automatic-updates
===========================

[![Build Status](https://travis-ci.org/softasap/sa-secure-automatic-updates.svg?branch=master)](https://travis-ci.org/softasap/sa-secure-automatic-updates)


Forces automatic installation of the security updates on Ubuntu 16.04 LTS servers



Example of use:
```YAML

- {
role: "sa-secure-automatic-updates"
}

```

Advanced:
```YAML
- {
role: "sa-secure-automatic-updates"
}
```

See box-example for standalone installation example


Usage with ansible galaxy workflow
----------------------------------

If you installed the sa-secure-automatic-updates role using the command


`
ansible galaxy install softasap.sa-secure-automatic-updates
`

the role will be available in the folder library\softasap.sa-vnc-remote-desktop.
Please adjust the path accordingly.

```YAML

- {
role: "softasap.sa-secure-automatic-updates"
}

```


Copyright and license
---------------------

Code licensed under the [BSD 3 clause] (https://opensource.org/licenses/BSD-3-Clause) or the [MIT License] (http://opensource.org/licenses/MIT).

Subscribe for roles updates at [FB] (https://www.facebook.com/SoftAsap/)


4 changes: 4 additions & 0 deletions box-example/.projmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "roles/sa-secure-automatic-updates"]
path = roles/sa-secure-automatic-updates
url = https://github.com/softasap/sa-secure-automatic-updates.git

6 changes: 6 additions & 0 deletions box-example/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

sudo apt-get install python-pip
sudo pip install -U pip
sudo -H pip install ansible
sudo -H pip install prudentia
8 changes: 8 additions & 0 deletions box-example/bootstrap_mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash


brew install git
brew install python
pip install -U pip
sudo -H pip install ansible
sudo -H pip install prudentia
18 changes: 18 additions & 0 deletions box-example/box.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- hosts: www

vars:
- root_dir: ..


pre_tasks:
- debug: msg="Pre tasks section"

roles:
- {
role: "sa-secure-automatic-updates"
}


tasks:
- debug: msg="Tasks section"
21 changes: 21 additions & 0 deletions box-example/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

git config -f .projmodules --get-regexp '^submodule\..*\.path$' > tempfile

while read -u 3 path_key path
do
url_key=$(echo $path_key | sed 's/\.path/.url/')
url=$(git config -f .projmodules --get "$url_key")

read -p "Are you sure you want to delete $path and re-initialize as a separate repository? " yn
case $yn in
[Yy]* ) rm -rf $path; git clone $url $path; echo "$path has been initialized";;
[Nn]* ) continue;;
* ) echo "Please answer yes or no.";;
esac

done 3<tempfile

rm tempfile

echo Project was checked out
23 changes: 23 additions & 0 deletions box-example/provision_box.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Static parameters
WORKSPACE=./
BOX_PLAYBOOK=$WORKSPACE/box.yml
BOX_NAME=sixteen
BOX_ADDRESS=192.168.0.50
BOX_USER=slavko
BOX_PWD=

prudentia ssh <<EOF
unregister $BOX_NAME
register
$BOX_PLAYBOOK
$BOX_NAME
$BOX_ADDRESS
$BOX_USER
$BOX_PWD
verbose 4
set box_address $BOX_ADDRESS
provision $BOX_NAME
EOF
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# defaults file for sa-secure-automatic-updates

role_dir: "{{role_path}}"
updates_notify_email: "root@locahost"
2 changes: 2 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for sa-secure-automatic-updates
Loading

0 comments on commit 10d37b2

Please sign in to comment.