8000 ansible.builtin.service fails for Sendmail on FreeBSD · Issue #84996 · ansible/ansible · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
ansible.builtin.service fails for Sendmail on FreeBSD #84996
Open
@pmhausen

Description

@pmhausen

Summary

Hello,

we have a task intending set the sendmail_enable variable to "NO" and have Sendmail restarted at the end by the handler named "Ensure sendmail is restarted". See code below in the "Steps to Reproduce" section.

While this looks contradictory at a first glance the reason is that for Sendmail (and only Sendmail) FreeBSD has three different settings (instead of only "YES" or "NO") for historical reasons:

  • NONE: all Sendmail services disabled
  • NO: local submit agent and queue runner enabled, mail server disabled - i.e. outbound mail yes, inbound no
  • YES: all services enabled including mail reception

I assume we get the error because Ansible tries to parse the output of sysrc and "NONE" is unexpected. When the task has run at least once one can change from "NO" to "YES" and back without further issues. Only the default of a newly installed FreeBSD system is "NONE".

Kind regards,
Patrick

Issue Type

Bug Report

Component Name

ansible.builtin.service

Ansible Version

$ ansible --version
ansible [core 2.18.4]
  config file = /Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg
  configured module search path = ['/Users/pmh/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/pmh/Hacking/Firma/ansible-proserver/venv-proserver/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/pmh/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/pmh/Hacking/Firma/ansible-proserver/venv-proserver/bin/ansible
  python version = 3.11.11 (main, Dec  7 2024, 10:43:09) [Clang 15.0.0 (clang-1500.3.9.4)] (/Users/pmh/Hacking/Firma/ansible-proserver/venv-proserver/bin/python3.11)
  jinja version = 3.1.4
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
ANSIBLE_COW_SELECTION(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = daemon
ANSIBLE_NOCOWS(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = True
BECOME_PASSWORD_FILE(env: ANSIBLE_BECOME_PASSWORD_FILE) = /Users/pmh/Hacking/Firma/ansible-proserver/become_password_file
CONFIG_FILE() = /Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg
DEFAULT_FORKS(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = 10
DEFAULT_HASH_BEHAVIOUR(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = merge
DEFAULT_HOST_LIST(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = ['/Users/pmh/Hacking/Firma/ansible-proserver/inventory/>
DEFAULT_MANAGED_STR(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = This file is managed by Ansible
DEFAULT_REMOTE_USER(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = ansible
DEFAULT_ROLES_PATH(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = ['/Users/pmh/Hacking/Firma/ansible-proserver/roles']
DEFAULT_STDOUT_CALLBACK(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = debug
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = /Users/pmh/Hacking/Firma/ansible-proserver/vault_password_file
EDITOR(env: EDITOR) = /usr/bin/vim
HOST_KEY_CHECKING(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = False
RETRY_FILES_ENABLED(/Users/pmh/Hacking/Firma/ansible-proserver/ansible.cfg) = False

OS / Environment

Management work OS: Mac OS Sonoma 14.6.1
Managed system: FreeBSD 14.2

Steps to Reproduce

- name: Ensure sendmail service is enabled
  ansible.builtin.service:
    name: sendmail
    enabled: no
  notify: Ensure sendmail is restarted

Expected Results

The play should not abort but just change the value from "NONE" to "NO".

Actual Results

fatal: [ah006]: FAILED! => {
    "changed": false
}

STDOUT:
sendmail_enable: NONE -> NO

MSG:
unable to set rcvar: sysrc did not change value

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects_2.18bugThis issue/PR relates to a bug.moduleThis issue/PR relates to a module.waiting_on_contributorThis would be accepted but there are no plans to actively work on it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0