diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..c8bc96e467ab4ea095832065f1d396bbb1aa3c5f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "library/shore"] + path = library/shore + url = https://www.shore.co.il/git/ansible-modules diff --git a/.travis.yml b/.travis.yml index 110a35a5e7721a77d423a0e102c69097f4f76d2c..95185ada79f6fbd139bbd9d65bf8d9f1de04e052 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,11 +11,8 @@ env: - platform: openbsd60 - &openbsd59 platform=openbsd59 - platform: xenial - - platform: trusty - - platform: precise - &stretch platform=stretch - platform: jessie - - platform: wheezy matrix: fast_finish: True allow_failures: diff --git a/defaults/main.yml b/defaults/main.yml index 2949b39db0be77b55b3aa36502b319ce762246c2..ac395c91c10afac4699a7a4f41a9da8c5aa9ea63 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,5 @@ --- # defaults file for certbot + +certbot_config: + domains: example.com diff --git a/library/shore b/library/shore new file mode 160000 index 0000000000000000000000000000000000000000..2efdc7b0a7d963ca5f2d7887530776906b319486 --- /dev/null +++ b/library/shore @@ -0,0 +1 @@ +Subproject commit 2efdc7b0a7d963ca5f2d7887530776906b319486 diff --git a/meta/main.yml b/meta/main.yml index b93e2057cf9798a493032c2a99a05b6f7d1edbe4..2e1dfec3eb77d12b24286d5ef8480fc152e6db6d 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -12,14 +12,16 @@ galaxy_info: - name: Ubuntu versions: - xenial - - trusty - - precise - name: Debian versions: - stretch - jessie - - wheezy galaxy_tags: [ ansible ] dependencies: - name: python27 src: adarnimrod.python27 + - name: backports + src: adarnimrod.backports + when: ansible_os_family == 'Debian' and ansible_distribution_release == 'jessie' + - name: ca-store + src: adarnimrod.ca-store diff --git a/tasks/main.yml b/tasks/main.yml index dc0d7e82e40767ce703ce0dcea35b50d0fee6f13..1538460e473f464abf36d51a52b749c22f6736ab 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,4 +5,28 @@ assert: that: - ansible_os_family in ['OpenBSD', 'Debian'] - - ansible_distribution_release in ['6.0', '5.9', 'xenial', 'trusty', 'precise', 'stretch', 'jessie', 'wheezy'] + - ansible_distribution_release in ['6.0', '5.9', 'xenial', 'trusty', 'precise', 'stretch', 'jessie'] + - certbot_config is iterable + - certbot_config['domains'] is defined + +- name: APT install + when: ansible_pkg_mgr == 'apt' + apt: + name: letsencrypt + state: present + update_cache: yes + cache_valid_time: 3600 + +- name: pkg add + when: ansible_pkg_mgr == 'openbsd_pkg' + openbsd_pkg: + name: letsencrypt + state: present + +- name: Copy config + template: + src: cli.ini + dest: /etc/letsencrypt/cli.ini + owner: root + group: 0 + mode: 0o0644 diff --git a/templates/cli.ini b/templates/cli.ini new file mode 100644 index 0000000000000000000000000000000000000000..11b453d4edc00eae621c4366d4f13de8244c511e --- /dev/null +++ b/templates/cli.ini @@ -0,0 +1,3 @@ +{% for key, value in certbot_config.iteritems() -%} +{{ key }} = {{ value }} +{%- endfor %} diff --git a/tests/test_certbot.py b/tests/test_certbot.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9fb7fb9bb01d16d9d5df8aa1e0233d72e96d2b4a 100644 --- a/tests/test_certbot.py +++ b/tests/test_certbot.py @@ -0,0 +1,2 @@ +def test_certbot_cli(Command): + assert Command('letsencrypt --version').rc == 0