The error says "results" don't exist. I think that line should be: when: 'enabled' in service_status.stdout_lines[0]
El viernes, 18 de diciembre de 2020 a la(s) 08:37:18 UTC-6, [email protected] escribió: > Hi, > > > I'm getting the below error. I've tried: service_status.stdout == > 'enabled', > and service.status.stdout.find('enabled') != -1 but no luck. > > > TASK [set_fact] > ********************************************************************************************* > fatal: [localhost]: FAILED! => {"msg": "The conditional check > 'service_status.results[0].stdout == 'enabled'' failed. The error was: > error while evaluating conditional (service_status.results[0].stdout == > 'enabled'): 'dict object' has no attribute 'results'\n\nThe error appears > > > > ================================================== > > > - name: Check if log package is installed. > block: > - name: Gather package facts. > become: true > package_facts: > manager: "auto" > - name: validating if the package is installed > debug: > msg: "{{ item }} is installed " > when: '"{{ item }}" in ansible_facts.packages' > with_items: > - rsyslog > register: rsyslog_check > > - name: check that log service is enabled if it's installed > shell: systemctl is-enabled rsyslog > register: service_status > > - debug: > var: service_status > > - name: check that log service is running. > shell: systemctl status rsyslog > register: active_status > - set_fact: > stig_text: "{{ stig_id }} FAILED. Log service isn't installed and /or > enabled or running." > when: "'rsyslog' in ansible_facts.packages" > > - set_fact: > stig_text: "PASSED" > when: > - service_status.results[0].stdout == 'enabled' > - active_status.stdout[0] == 'running' > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b2d550de-632c-4d99-8c39-37feb5dde4a5n%40googlegroups.com.
