ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
784 stars 1.45k forks source link

sysrc: start service #8544

Open jtagcat opened 2 weeks ago

jtagcat commented 2 weeks ago

Summary

- name: Enable nginx
  community.general.sysrc:
    name: nginx_enable
    value: "YES"

^ Example does not ensure the service is started. I'd like to see nginx as the name, which both enables and (re)starts the service.

Issue Type

Feature Idea

Component Name

sysrc

Additional Information

Alternative:

  - name: 'nginx: ensure pkg'
    community.general.pkgng:
      name: nginx
      state: latest
  - name: 'nginx: enable service'
    community.general.sysrc:
      name: nginx_enable
      value: "YES"
  - name: 'nginx: start service'
    shell: service nginx start
    register: result
    changed_when: "result.rc == 0"
    failed_when: 'result.rc != 0 and (result.rc == 1 and not "already running" in result.stderr)'

Code of Conduct

ansibullbot commented 2 weeks ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 weeks ago

cc @dlundgren click here for bot help