Help on ansible tasks

Please can someone help as i am having hard time to debug or troubleshoot below ansible module tasks.

I am trying to format an ebs volume attached to an ec2 instance.i am getting below error.

{
“changed”: false,
“failed”: true,
“invocation”: {
“module_args”: {
“dev”: “/dev/xvdf”,
“force”: false,
“fstype”: “ext4”,
“opts”: “-t”,
“resizefs”: false
},
“module_name”: “filesystem”
},
“msg”: “Device /dev/xvdf not found.”
}

when i logged into ec2 instance and typed lsblk i can verify xvdf volume attached.

sudo mkfs -t ext4 /dev/xvdf

above is successfully.

Similarly i am encountering unchanged modules
apt_key and apt_repository

  • name: PostgreSQL | Add PostgreSQL repository apt-key
    apt_key:
    id: “{{ postgresql_apt_key_id }}”
    url: “{{ postgresql_apt_key_url }}”
    state: present
    register: apt_result

  • name: PostgreSQL | Add PostgreSQL repository
    apt_repository:
    repo: “{{ postgresql_apt_repository }}”
    state: present
    update_cache: true
    filename: “postgres”
    when: apt_result|succeeded
    register: repoadd

Thanks in Advance

I am unsuccessful debugging above things. I appreciate if someone can shed some light into the issue and bring me into light.

I am currently using Ansible 2.2.0 Version installed on ubuntu 16.04 LTS. I am repeatedly running playbook multiple times during entire infrastructure playbook development.which is causing below modules changed flag to false.

apt_key and apt_repository

  • name: PostgreSQL | Add PostgreSQL repository apt-key
    apt_key:
    id: “{{ postgresql_apt_key_id }}”
    url: “{{ postgresql_apt_key_url }}”
    state: present
    register: apt_result

  • name: PostgreSQL | Add PostgreSQL repository
    apt_repository:
    repo: “{{ postgresql_apt_repository }}”
    state: present
    update_cache: true
    filename: “postgres”
    when: apt_result|succeeded
    register: repoadd

I am successfully when i stand new instance and run first time but no luck after that one.I am suspecting something to do with ansible cache so i have flushed busted cache also.

ansible-playbook playbook.yml --flush-cache

Can someone help me out here as i am stuck in middle of ocean.

I have found my defect…

Thanks for help and Enjoy coding…

Then why don't you tell us what the problem was? The next one looking
will be glad...

Johannes