Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exclude_paths:
- ./meta/readme.yml
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ services:
- docker
env:
global:
- role: franklinkim.cron
- role: weareinteractive.cron
matrix:
- distribution: Ubuntu
distribution_version: "18.04"
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
# TODO: ansible currently detects the system mgr as 'upstart'
#- distribution: Ubuntu
# distribution_version: "16.04"
# init: /lib/systemd/systemd
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distribution: Ubuntu
distribution_version: "16.04"
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distribution: Ubuntu
distribution_version: "14.04"
init: /sbin/init
Expand Down Expand Up @@ -39,9 +43,6 @@ script:
# Start The Built Container In The Background
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/${role}:ro ${run_opts} ansiblecheck/ansiblecheck:"${distribution,,}"-"${distribution_version}" "${init}" > "${container_id}"'

# Optionally install dependencies
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-galaxy install weareinteractive.apt franklinkim.openssl franklinkim.htpasswd'

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

Expand All @@ -53,7 +54,7 @@ script:
- docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/${role}/tests/main.yml | tee -a ${idempotence}
- >
tail ${idempotence}
| grep -q 'failed=0'
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)

Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
<a name="1.6.0"></a>
## 1.6.0 (2019-06-17)


#### Features

* improve distribution handling ([6c35a5c1](https://github.com/weareinteractive/ansible-cron/commit/6c35a5c1a67f98d8aded0a060c123b05f2525bac))



<a name="1.5.0"></a>
## 1.5.0 (2019-05-13)


#### Features

* rename role ([5f35dd45](https://github.com/weareinteractive/ansible-cron/commit/5f35dd458b4e0ec12247b1880e5a4ca424ff53a1))



<a name="1.4.2"></a>
### 1.4.2 (2019-05-13)




<a name="1.4.1"></a>
### 1.4.1 (2018-06-29)

Expand Down
27 changes: 23 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
PWD=$(shell pwd)
ROLE_NAME=franklinkim.cron
ROLE_NAME=weareinteractive.cron
ROLE_PATH=/etc/ansible/roles/$(ROLE_NAME)
TEST_VERSION=ansible --version
TEST_SYNTAX=ansible-playbook -v -i 'localhost,' -c local $(ROLE_PATH)/tests/main.yml --syntax-check
TEST_PLAYBOOK=ansible-playbook -vvvv -i 'localhost,' -c local $(ROLE_PATH)/tests/main.yml
TEST_CMD=$(TEST_VERSION); $(TEST_SYNTAX); $(TEST_PLAYBOOK); $(TEST_PLAYBOOK)
TEST_PLAYBOOK=ansible-playbook -v -i 'localhost,' -c local $(ROLE_PATH)/tests/main.yml
TEST_IDEMPOTENT=$(TEST_PLAYBOOK) | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1)
TEST_CMD=$(TEST_VERSION); $(TEST_SYNTAX); $(TEST_DEPS); $(TEST_PLAYBOOK); $(TEST_IDEMPOTENT)

lint:
ansible-lint .

ubuntu%: TEST_DEPS=apt-get update && \
apt-get install -y python

ubuntu18.04: dist=ubuntu-18.04
ubuntu18.04: .run

ubuntu16.04: dist=ubuntu-16.04
ubuntu16.04: .run

ubuntu14.04: dist=ubuntu-14.04
ubuntu14.04: .run

debian%: TEST_DEPS=apt-get update && \
apt-get install -y python

debian9: dist=debian-9
debian9: .run

debian8: dist=debian-8
debian8: .run

centos%: TEST_DEPS=apt-get update && \
yum install -y python

centos7: dist=el-7
centos7: .run

.run:
docker run -it --rm -v $(PWD):$(ROLE_PATH) ansiblecheck/ansiblecheck:$(dist) /bin/bash -c "$(TEST_CMD)"
@echo "RUN:"
@echo " docker run -it --rm -v $(PWD):$(ROLE_PATH) ansiblecheck/ansiblecheck:$(dist) /bin/bash"
@echo " $(TEST_CMD)"
@docker run -it --rm -v $(PWD):$(ROLE_PATH) ansiblecheck/ansiblecheck:$(dist) /bin/bash -c "$(TEST_CMD)"
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
# Ansible franklinkim.cron role
# Ansible weareinteractive.cron role

[![Build Status](https://img.shields.io/travis/weareinteractive/ansible-cron.svg)](https://travis-ci.org/weareinteractive/ansible-cron)
[![Galaxy](http://img.shields.io/badge/galaxy-franklinkim.cron-blue.svg)](https://galaxy.ansible.com/franklinkim/cron)
[![Galaxy](http://img.shields.io/badge/galaxy-weareinteractive.cron-blue.svg)](https://galaxy.ansible.com/weareinteractive/cron)
[![GitHub Tags](https://img.shields.io/github/tag/weareinteractive/ansible-cron.svg)](https://github.com/weareinteractive/ansible-cron)
[![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/ansible-cron.svg)](https://github.com/weareinteractive/ansible-cron)

> `franklinkim.cron` is an [Ansible](http://www.ansible.com) role which:
> `weareinteractive.cron` is an [Ansible](http://www.ansible.com) role which:
>
> * installs cron
> * adds cron tasks
> * configures service

**Note:**

> Since Ansible Galaxy supports [organization](https://www.ansible.com/blog/ansible-galaxy-2-release) now, this role has moved from `franklinkim.cron` to `weareinteractive.cron`!

## Installation

Using `ansible-galaxy`:

```shell
$ ansible-galaxy install franklinkim.cron
$ ansible-galaxy install weareinteractive.cron
```

Using `requirements.yml`:

```yaml
- src: franklinkim.cron
- src: weareinteractive.cron
```

Using `git`:

```shell
$ git clone https://github.com/weareinteractive/ansible-cron.git franklinkim.cron
$ git clone https://github.com/weareinteractive/ansible-cron.git weareinteractive.cron
```

## Dependencies
Expand Down Expand Up @@ -100,8 +104,9 @@ This is an example playbook:
---

- hosts: all
become: yes
roles:
- franklinkim.cron
- weareinteractive.cron
vars:
cron_tasks:
- name: checking dirs
Expand Down
4 changes: 4 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Vagrant.configure("2") do |config|
config.vbguest.no_remote = true
config.vbguest.auto_update = false

config.vm.define 'bionic' do |instance|
instance.vm.box = 'ubuntu/bionic64'
end

config.vm.define 'xenial' do |instance|
instance.vm.box = 'ubuntu/xenial64'
end
Expand Down
8 changes: 6 additions & 2 deletions meta/readme.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---

galaxy_name: franklinkim.cron
galaxy_name: weareinteractive.cron
github_user: weareinteractive
github_name: ansible-cron
badges: |
[![Build Status](https://img.shields.io/travis/weareinteractive/ansible-cron.svg)](https://travis-ci.org/weareinteractive/ansible-cron)
[![Galaxy](http://img.shields.io/badge/galaxy-franklinkim.cron-blue.svg)](https://galaxy.ansible.com/franklinkim/cron)
[![Galaxy](http://img.shields.io/badge/galaxy-weareinteractive.cron-blue.svg)](https://galaxy.ansible.com/weareinteractive/cron)
[![GitHub Tags](https://img.shields.io/github/tag/weareinteractive/ansible-cron.svg)](https://github.com/weareinteractive/ansible-cron)
[![GitHub Stars](https://img.shields.io/github/stars/weareinteractive/ansible-cron.svg)](https://github.com/weareinteractive/ansible-cron)
description: |
> * installs cron
> * adds cron tasks
> * configures service

**Note:**

> Since Ansible Galaxy supports [organization](https://www.ansible.com/blog/ansible-galaxy-2-release) now, this role has moved from `franklinkim.cron` to `weareinteractive.cron`!
7 changes: 7 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
- install
- cron-install

- import_tasks: python.yml
tags:
- system
- python
- install
- python-install

- import_tasks: config.yml
tags:
- system
Expand Down
12 changes: 12 additions & 0 deletions tasks/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: add python deadsnakes repository
become: true
apt_repository:
repo: ppa:deadsnakes/ppa

- name: install python3
become: true
apt:
name: python3.8
state: latest
update_cache: yes
14 changes: 12 additions & 2 deletions tasks/vars.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
---

- name: Including variables
include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
- name: Set variables for CentOS
set_fact:
cron_package: "{{ cron_package | default('crontabs') }}"
cron_service_name: "{{ cron_service_name | default('crond') }}"
when: ansible_os_family == "RedHat"

- name: Set variables for Debian/Ubuntu
set_fact:
cron_package: "{{ cron_package | default('cron') }}"
cron_service_name: "{{ cron_service_name | default('cron') }}"
when:
- ansible_os_family == "Debian"
3 changes: 2 additions & 1 deletion tests/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---

- hosts: all
become: yes
roles:
- franklinkim.cron
- weareinteractive.cron
vars:
cron_tasks:
- name: checking dirs
Expand Down
6 changes: 0 additions & 6 deletions vars/CentOS-Core.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/Debian-jessie.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/Debian-stretch.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/Ubuntu-bionic.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/Ubuntu-trusty.yml

This file was deleted.

6 changes: 0 additions & 6 deletions vars/Ubuntu-xenial.yml

This file was deleted.