{"id":1448,"sha1":"809fed6fbcbb2cd31f6e4e3df0722e6d9d86f47d","playbook":{"id":1203,"items":{"plays":1,"tasks":13,"results":13,"hosts":1,"files":6,"records":0},"arguments":{"version":null,"verbosity":3,"private_key_file":"/home/ssh-gateway/.ssh/id_rsa","remote_user":"root","connection":"ssh","timeout":null,"ssh_common_args":null,"sftp_extra_args":null,"scp_extra_args":null,"ssh_extra_args":null,"ask_pass":false,"connection_password_file":null,"force_handlers":false,"flush_cache":false,"become":false,"become_method":"sudo","become_user":null,"become_ask_pass":false,"become_password_file":null,"tags":["all"],"skip_tags":[],"check":false,"diff":false,"inventory":["/home/ssh-gateway/ansible/bash-kvm-inventory-prod.sh"],"listhosts":false,"subset":"*versatile-chipmunk*","extra_vars":"Not saved by ARA as configured by 'ignored_arguments'","vault_ids":[],"ask_vault_pass":false,"vault_password_files":[],"forks":20,"module_path":null,"syntax":false,"listtasks":false,"listtags":false,"step":false,"start_at_task":null,"args":["projects/RM9703/RM9703-update-httpd.yaml"]},"labels":[{"id":1,"name":"remote_user:root"},{"id":2,"name":"check:False"},{"id":3,"name":"tags:all"},{"id":100,"name":"subset:*versatile-chipmunk*"}],"started":"2024-08-22T11:14:10.137567+01:00","ended":"2024-08-22T11:14:22.980676+01:00","duration":"00:00:12.843109","name":null,"ansible_version":"2.16.0","client_version":"1.7.1","python_version":"3.10.10","server_version":"1.7.1","status":"completed","path":"/home/ssh-gateway/ansible/projects/RM9703/RM9703-update-httpd.yaml","controller":"ssh-gw-4.layershift.com","user":"root"},"content":"---\n- name: Playbook to update httpd\n  hosts: all\n  roles:\n    - plesk\n  tasks:\n    - name: Update and check\n      when: \"'Plesk' in plsk_out.stdout\"\n      block:\n        - name: Verify Apache configuration\n          ansible.builtin.command: apachectl configtest\n          register: apachectl_result\n          changed_when: false\n        - name: Fail if Apache configuration is incorrect\n          ansible.builtin.fail:\n            msg: \"Apache configuration test failed: {{ apachectl_result.stderr | default('') }} {{ apachectl_result.stdout | default('') }}\"\n          when: apachectl_result.rc != 0\n        - name: Check if OS is CentOS\n          ansible.builtin.set_fact:\n            package_manager: \"{{ 'yum' if ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] == '7' else 'dnf' }}\"\n        - name: Update httpd with cache rebuild CentOS\n          when: package_manager == \"yum\"\n          ansible.builtin.yum:\n            name: httpd\n            state: latest\n            update_cache: true\n        - name: Rebuild cache and update httpd alma\n          when: package_manager == \"dnf\"\n          ansible.builtin.dnf:\n            name: httpd\n            state: latest\n            update_cache: true\n        - name: Restart httpd service\n          ansible.builtin.systemd:\n            name: httpd\n            state: restarted\n        - name: Verify that httpd service is active and running\n          ansible.builtin.systemd:\n            name: httpd\n            state: started\n          register: httpd_service_status\n          failed_when:\n            - httpd_service_status.status.ActiveState != \"active\"\n        - name: Notify if httpd service restarted successfully\n          ansible.builtin.debug:\n            msg: \"The httpd service has been restarted successfully and is active.\"\n          when: httpd_service_status.status.ActiveState == \"active\"\n","created":"2024-08-22T11:14:10.161123+01:00","updated":"2024-08-22T11:14:10.161144+01:00","path":"/home/ssh-gateway/ansible/projects/RM9703/RM9703-update-httpd.yaml"}