elastic/ansible-beats

Service doesn't restarted if service already ran

levonet opened this issue · 2 comments

Ansible doesn't restart service with state=started if service already ran.

Rule in handlers name: restart beat was False because beat_install.changed = false.

  when: start_service and restart_on_change and not beats_started.changed and beat_install.changed

log:

TASK [beats : RedHat - Ensure filebeat is installed] *******************************************************************************************************************************************************
ok: [globus2.dev.*****] => {"changed": false, "msg": "", "rc": 0, "results": ["filebeat-6.2.4-1.x86_64 providing filebeat-6.2.4 is already installed"]}

...

TASK [beats : Copy Configuration File] *********************************************************************************************************************************************************************
changed: [globus2.dev.*****] => {"changed": true, "checksum": "2c2692b5147416348ef64099617cec9ff32fe69e", "dest": "/etc/filebeat/filebeat.yml", "gid": 0, "group": "root", "md5sum": "9e3c78e1796ae48dee244939eb3b64f3", "mode": "0644", "owner": "root", "secontext": "system_u:object_r:etc_t:s0", "size": 999, "src": "/home/pasha/.ansible/tmp/ansible-tmp-1527153468.01-180088665979184/source", "state": "file", "uid": 0}

TASK [beats : Start beats service] *************************************************************************************************************************************************************************
ok: [globus2.dev.*****] => {"changed": false, "enabled": true, "name": "filebeat", "state": "started", "status": {"ActiveEnterTimestamp": "Thu 2018-05-24 04:03:24 UTC", "ActiveEnterTimestampMonotonic": "20510694", "ActiveExitTimestampMonotonic": "0", "ActiveState": "active", "After": "network-online.target systemd-journald.socket basic.target system.slice", "AllowIsolate": "no", "AmbientCapabilities": "0", "AssertResult": "yes", "AssertTimestamp": "Thu 2018-05-24 04:03:24 UTC", "AssertTimestampMonotonic": "20510080", "Before": "multi-user.target shutdown.target", "BlockIOAccounting": "no", "BlockIOWeight": "18446744073709551615", "CPUAccounting": "no", "CPUQuotaPerSecUSec": "infinity", "CPUSchedulingPolicy": "0", "CPUSchedulingPriority": "0", "CPUSchedulingResetOnFork": "no", "CPUShares": "18446744073709551615", "CanIsolate": "no", "CanReload": "no", "CanStart": "yes", "CanStop": "yes", "CapabilityBoundingSet": "18446744073709551615", "ConditionResult": "yes", "ConditionTimestamp": "Thu 2018-05-24 04:03:24 UTC", "ConditionTimestampMonotonic": "20510080", "Conflicts": "shutdown.target", "ControlGroup": "/system.slice/filebeat.service", "ControlPID": "0", "DefaultDependencies": "yes", "Delegate": "no", "Description": "filebeat", "DevicePolicy": "auto", "Documentation": "https://www.elastic.co/guide/en/beats/filebeat/current/index.html", "ExecMainCode": "0", "ExecMainExitTimestampMonotonic": "0", "ExecMainPID": "856", "ExecMainStartTimestamp": "Thu 2018-05-24 04:03:24 UTC", "ExecMainStartTimestampMonotonic": "20510647", "ExecMainStatus": "0", "ExecStart": "{ path=/usr/share/filebeat/bin/filebeat ; argv[]=/usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat.yml -path.home /usr/share/filebeat -path.config /etc/filebeat -path.data /var/lib/filebeat -path.logs /var/log/filebeat ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }", "FailureAction": "none", "FileDescriptorStoreMax": "0", "FragmentPath": "/usr/lib/systemd/system/filebeat.service", "GuessMainPID": "yes", "IOScheduling": "0", "Id": "filebeat.service", "IgnoreOnIsolate": "no", "IgnoreOnSnapshot": "no", "IgnoreSIGPIPE": "yes", "InactiveEnterTimestampMonotonic": "0", "InactiveExitTimestamp": "Thu 2018-05-24 04:03:24 UTC", "InactiveExitTimestampMonotonic": "20510694", "JobTimeoutAction": "none", "JobTimeoutUSec": "0", "KillMode": "control-group", "KillSignal": "15", "LimitAS": "18446744073709551615", "LimitCORE": "18446744073709551615", "LimitCPU": "18446744073709551615", "LimitDATA": "18446744073709551615", "LimitFSIZE": "18446744073709551615", "LimitLOCKS": "18446744073709551615", "LimitMEMLOCK": "65536", "LimitMSGQUEUE": "819200", "LimitNICE": "0", "LimitNOFILE": "4096", "LimitNPROC": "39291", "LimitRSS": "18446744073709551615", "LimitRTPRIO": "0", "LimitRTTIME": "18446744073709551615", "LimitSIGPENDING": "39291", "LimitSTACK": "18446744073709551615", "LoadState": "loaded", "MainPID": "856", "MemoryAccounting": "no", "MemoryCurrent": "18446744073709551615", "MemoryLimit": "18446744073709551615", "MountFlags": "0", "Names": "filebeat.service", "NeedDaemonReload": "no", "Nice": "0", "NoNewPrivileges": "no", "NonBlocking": "no", "NotifyAccess": "none", "OOMScoreAdjust": "0", "OnFailureJobMode": "replace", "PermissionsStartOnly": "no", "PrivateDevices": "no", "PrivateNetwork": "no", "PrivateTmp": "no", "ProtectHome": "no", "ProtectSystem": "no", "RefuseManualStart": "no", "RefuseManualStop": "no", "RemainAfterExit": "no", "Requires": "basic.target", "Restart": "always", "RestartUSec": "100ms", "Result": "success", "RootDirectoryStartOnly": "no", "RuntimeDirectoryMode": "0755", "SameProcessGroup": "no", "SecureBits": "0", "SendSIGHUP": "no", "SendSIGKILL": "yes", "Slice": "system.slice", "StandardError": "inherit", "StandardInput": "null", "StandardOutput": "journal", "StartLimitAction": "none", "StartLimitBurst": "5", "StartLimitInterval": "10000000", "StartupBlockIOWeight": "18446744073709551615", "StartupCPUShares": "18446744073709551615", "StatusErrno": "0", "StopWhenUnneeded": "no", "SubState": "running", "SyslogLevelPrefix": "yes", "SyslogPriority": "30", "SystemCallErrorNumber": "0", "TTYReset": "no", "TTYVHangup": "no", "TTYVTDisallocate": "no", "TasksAccounting": "no", "TasksCurrent": "18446744073709551615", "TasksMax": "18446744073709551615", "TimeoutStartUSec": "1min 30s", "TimeoutStopUSec": "1min 30s", "TimerSlackNSec": "50000", "Transient": "no", "Type": "simple", "UMask": "0022", "UnitFilePreset": "disabled", "UnitFileState": "enabled", "WantedBy": "multi-user.target", "Wants": "network-online.target system.slice", "WatchdogTimestamp": "Thu 2018-05-24 04:03:24 UTC", "WatchdogTimestampMonotonic": "20510676", "WatchdogUSec": "0"}}

RUNNING HANDLER [beats : restart beat] *********************************************************************************************************************************************************************
skipping: [globus2.dev.*****] => {"changed": false, "skip_reason": "Conditional result was False"}

@Crazybus when this be fixed?

ynux commented

This is not fixed in tag 7.0.0. . And that is the version you get with ansible-galaxy.