I got the following error when I tried to remove the 
/etc/yum.repos.d/redhat-rhui.repo file. My playbook is as following:


- name: Configure BASE Linux Servers
hosts: linux
gather_facts: true
become: yes
become_user: root
pre_tasks:
- name: Debug
raw: sleep 1
- name: get the username running the deploy
become: false
local_action: command whoami
register: username_on_the_host
- debug: var=username_on_the_host
- name: Remove AWS RHUI
file:
path: "{{ item }}"
state: absent
force: yes
with_items:
- /etc/yum.repos.d/redhat-rhui.repo

roles:
- { role: linux_common, tags: linux_common }
- { role: deep_security_agent, tags: deep_security_agent }




*********output with error *********************************
    amazon-ebs: changed: [default]
    amazon-ebs:
    amazon-ebs: TASK [get the username running the deploy] 
****************************                        *********
    amazon-ebs: changed: [default -> localhost]
    amazon-ebs:
    amazon-ebs: TASK [debug] 
**********************************************************                  
      *********
    amazon-ebs: ok: [default] => {
    amazon-ebs:     "username_on_the_host": {
    amazon-ebs:         "changed": true,
    amazon-ebs:         "cmd": [
    amazon-ebs:             "whoami"
    amazon-ebs:         ],
    amazon-ebs:         "delta": "0:00:01.747620",
    amazon-ebs:         "end": "2019-02-22 02:03:25.776013",
    amazon-ebs:         "failed": false,
    amazon-ebs:         "rc": 0,
    amazon-ebs:         "start": "2019-02-22 02:03:24.028393",
    amazon-ebs:         "stderr": "",
    amazon-ebs:         "stderr_lines": [],
    amazon-ebs:         "stdout": "root",
    amazon-ebs:         "stdout_lines": [
    amazon-ebs:             "root"
    amazon-ebs:         ]
    amazon-ebs:     }
    amazon-ebs: }
    amazon-ebs:
    amazon-ebs: TASK [Remove AWS RHUI] 
************************************************                        
*********
    amazon-ebs: failed: [default] (item=/etc/yum.repos.d/redhat-rhui.repo) 
=> {"changed                        ": false, "gid": 0, "group": "root", 
"item": "/etc/yum.repos.d/redhat-rhui.repo", "mode                        
": "0644", "msg": "unlinking failed: [Errno 13] Permission denied: 
'/etc/yum.repos.d/re                        dhat-rhui.repo' ", "owner": 
"root", "path": "/etc/yum.repos.d/redhat-rhui.repo", "secon                
        text": "system_u:object_r:system_conf_t:s0", "size": 8679, "state": 
"file", "uid": 0}
    amazon-ebs:         to retry, use: --limit 
@/workdir/Ansible/playbooks/common/Confi                        
gure_Base_Linux.retry
    amazon-ebs:
    amazon-ebs: PLAY RECAP 
************************************************************                
        *********
    amazon-ebs: default                    : ok=4    changed=2    
unreachable=0    fail                        ed=1
    amazon-ebs:
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Error executing Ansible: Non-zero exit status: 
exit status 2

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Error executing Ansible: Non-zero exit status: exit status 2

==> Builds finished but no artifacts were created.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to