diff --git a/defaults/main.yml b/defaults/main.yml index 51056cc..c6772ad 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,7 @@ --- # @var renovatebot_image:description: Docker image to use. renovatebot_image: renovate/renovate:latest +renovatebot_service_stopped: False # @var renovatebot_interval:description: Interval for the systemd timer. renovatebot_interval: daily diff --git a/handlers/main.yml b/handlers/main.yml index 947145a..aa83bba 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,7 +1,7 @@ --- - name: Restart docker-renovate systemd: - state: restarted + state: "{{ renovatebot_service_stopped | ternary('stopped', 'restarted', 'restarted') }}" daemon_reload: yes name: renovate listen: __renovate_restart diff --git a/molecule/centos7/converge.yml b/molecule/centos7/converge.yml index 5068056..037d2c7 100644 --- a/molecule/centos7/converge.yml +++ b/molecule/centos7/converge.yml @@ -8,6 +8,8 @@ - epel-release - python-pip - python-virtualenv + renovatebot_service_stopped: True + renovatebot_token: personal-access-token roles: - role: xoxys.docker_engine diff --git a/molecule/centos7/tests/test_default.py b/molecule/centos7/tests/test_default.py index ec82bc6..88e8844 100644 --- a/molecule/centos7/tests/test_default.py +++ b/molecule/centos7/tests/test_default.py @@ -12,5 +12,4 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_renovate_running_and_enabled(host): service = host.service("renovate.timer") - assert service.is_running assert service.is_enabled diff --git a/tasks/setup.yml b/tasks/setup.yml index 0c31420..a738a7a 100644 --- a/tasks/setup.yml +++ b/tasks/setup.yml @@ -23,6 +23,6 @@ name: renovate.timer daemon_reload: yes enabled: yes - state: started + state: "{{ renovatebot_service_stopped | ternary('stopped', 'started', 'started') }}" become: True become_user: root diff --git a/templates/etc/sysconfig/renovate.j2 b/templates/etc/sysconfig/renovate.j2 index 5e1c128..c03a2f9 100644 --- a/templates/etc/sysconfig/renovate.j2 +++ b/templates/etc/sysconfig/renovate.j2 @@ -2,12 +2,10 @@ {{ ansible_managed | comment }} {% if renovatebot_github_token is defined %} -GITHUB_COM_TOKEN="{{ renovatebot_github_token }}" -{% endif %} -RENOVATE_AUTODISCOVER="{{ renovatebot_autodiscover | bool | lower }}" -RENOVATE_ENDPOINT="{{ renovatebot_endpoint }}" -RENOVATE_GIT_AUTHOR="{{ renovatebot_git_author }}" -RENOVATE_PLATFORM="{{ renovatebot_platform }}" -{% if renovatebot_token is defined %} -RENOVATE_TOKEN="{{ renovatebot_token }}" +GITHUB_COM_TOKEN={{ renovatebot_github_token }} {% endif %} +RENOVATE_AUTODISCOVER={{ renovatebot_autodiscover | bool | lower }} +RENOVATE_ENDPOINT={{ renovatebot_endpoint }} +RENOVATE_GIT_AUTHOR={{ renovatebot_git_author }} +RENOVATE_PLATFORM={{ renovatebot_platform }} +RENOVATE_TOKEN={{ renovatebot_token }}