Giter VIP home page Giter VIP logo

ansible-role-systemd-service's Introduction

Hi.

ansible-role-systemd-service's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ansible-role-systemd-service's Issues

systemd_service_Service_ExecReload is missing

I tried to configure reloading, but the documented var is incorrect.

The docs say systemd_service_Service_ExecReload, which is consistent with the rest

But the code says systemd_service_ExecReload

Add include_role example

I'm trying to use this from another role, but just get errors. A correct example in the readme would be helpful!

- name: setup nsd_exporter service
  include_role:
    name: tumf.systemd-service
  vars:
    systemd_service_name: "nsd_exporter"
    systemd_service_Service_ExecStart: "/opt/bin/nsd_exporter"

gives me this error:

ERROR! Invalid options for include_role: systemd_service_Service_ExecStart,systemd_service_name

I realize this isn't a problem with the role but really me not understanding the ansible documentation, but I thought still an example in the README here would be useful as I am guessing this might be a common use case. :-)

Print errors in case of reload failure

Sometimes we provide bad parameters and systemd reload will fail, with a generic message such as

"Failed to restart app-opstest.service: Unit app-opstest.service is not loaded properly: Invalid argument.\nSee system logs and 'systemctl status app-opstest.service' for details."

Would be nice if this was detected in the role and automatically have the errors displayed

systemd_service_name not defined

I don't believe this is an issue with this role, but I wanted to run this past you just in case you've seen it before or I'm doing something stupid.

I'm attempting to call this role from one of my own. They're being run by the Packer Ansible provisioner. It was working a couple of weeks ago. At the time, I had the following vars set in defaults/main.yml:

      systemd_service_name: 'ansible-bootstrap'
      systemd_service_Unit_Description: 'Run ansible-pull at boot to do post-launch configuration'
      systemd_service_Service_ExecStartPre: '-/usr/bin/ansible-galaxy install -f -r /opt/bootstrap/playbook/requirements.yml'
      systemd_service_Service_ExecStart: |
        /usr/bin/ansible-pull \
        -f -s 15 \
        -c local -i "localhost," \
        -e "@/opt/bootstrap/playbook_vars.yml" \
        -U {{ bootstrap_playbook_repo }} \
        -d /opt/bootstrap/playbook \
        --key-file="{{ bootstrap_playbook_keyfile | default('') }}"

When I tried rebuilding the image today, it started failing on the systemd_service handler with the following error:

amazon-ebs: fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'systemd_service_name' is undefined\n\nThe error appears to have been in '/tmp/packer-provisioner-ansible-local/59972dbd-d8b5-6a33-a238-a1e2082ec2cf/roles/tumf.systemd-service/handlers/main.yml': line 3, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# handlers file for roles/systemd/service\n- name: reload systemd\n  ^ here\n"}

I moved the vars into vars/main.yml but that resulted in the same error. I finally moved them into the include_role call's vars option as well and now Ansible fails a little earlier. Instead of failing on the handler, it fails on the template call:

    amazon-ebs: fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'systemd_service_name' is undefined\n\nThe error appears to have been in '/tmp/packer-provisioner-ansible-local/599730e4-50fc-d6d7-9c97-e1e8bb12fcce/roles/tumf.systemd-service/tasks/main.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- template: src=\"default.j2\" dest=\"{{ ansible_unit_test_prefix_dir }}/{{ systemd_service_default_dir }}/{{ systemd_service_name }}\"\n  ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes.  Always quote template expression brackets when they\nstart a value. For instance:\n\n    with_items:\n      - {{ foo }}\n\nShould be written as:\n\n    with_items:\n      - \"{{ foo }}\"\n"}

Again, I don't believe this is an issue with your role, but I'm not sure what the issue might be at this point. Any help you could provide would be appreciated. Thanks!

Support for multiple services via list

Trying to utilize this role to support multiple systemd unit files is frustrating with ansible's current role implementation in playbooks. It would be great if this role could support piping in a list of dictionary values defining multiple roles.

I've tried to work around this limitation with include_role and the vars keyword and am hitting limitations in ansible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.