Ansible package and copy module issue

  1. package module issue:

I have created the entry in remote host sudeors directory.

root@a:/etc/sudoers.d# cat ansibleusers
ansibleusers ALL=(ALL:ALL) NOPASSWD :ALL
root@a:/etc/sudoers.d#

Getting below error while running the command.

vaibhavarora@ubuntu:~ ansible ec2 -m package -a 'name=nginx state=present' --become ec2 | FAILED! => { "changed": false, "failed": true, "msg": "Could not detect which package manager to use. Try gathering facts or setting the \"use\" option." } vaibhavarora@ubuntu:~

  1. Issue with copy module:

  2. Created the inventory file

vaibhavarora@ubuntu:~$ cat inventory

ec2 ansible_host=18.220.81.130 ansible_private_key_file=./ansibleuser ansible_ssh_user=ansibleusers

vaibhavarora@ubuntu:~$

vaibhavarora@ubuntu:~$ ansible ec2 -m copy -a ‘src=inventory dest=/home/ansibleusers’

Output:

ec2 | FAILED! => {

"changed": false,

"checksum": "dcba529738d8fa270479276b669835cb1ee8eb30",

"failed": true,

"msg": "Unsupported parameters for (copy) module: original_basename Supported parameters include: _original_basename,attributes,backup,checksum,content,delimiter,dest,directory_mode,follow,force,group,local_follow,mode,owner,regexp,remote_src,selevel,serole,setype,seuser,src,unsafe_writes,validate"

}

vaibhavarora@ubuntu:~$ ansible --version

ansible 2.4.0.0

config file = /home/vaibhavarora/ansible.cfg

configured module search path = [u’/home/vaibhavarora/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]

ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible

executable location = /usr/local/bin/ansible

python version = 2.7.17 (default, Sep 30 2020, 13:38:04) [GCC 7.5.0]

vaibhavarora@ubuntu:~$

I tried with this using below but no luck.

vaibhavarora@ubuntu:~$ ansible ec2 -m copy -a ‘src=/home/vaibhavarora/adhoc/prod.env dest=/home/ansibleusers owner=ansibleusers group=ansibleusers mode=0644’

ec2 | FAILED! => {

"changed": false,

"checksum": "02cdc2c17b26c5228497a9ddfa41d8c0d9186542",

"failed": true,

"msg": "Unsupported parameters for (copy) module: original_basename Supported parameters include: _original_basename,attributes,backup,checksum,content,delimiter,dest,directory_mode,follow,force,group,local_follow,mode,owner,regexp,remote_src,selevel,serole,setype,seuser,src,unsafe_writes,validate"

}

But Ping is working fine.

vaibhavarora@ubuntu:~$ ansible ec2 -m ping

ec2 | SUCCESS => {

"changed": false,

"failed": false,

"ping": "pong"

}

vaibhavarora@ubuntu:~$

And able to create the directory as well.

vaibhavarora@ubuntu:~$ ansible ec2 -m file -a ‘path=/tmp/data1 state=directory’

ec2 | SUCCESS => {

"changed": true,

"failed": false,

"gid": 1025,

"group": "ansibleusers",

"mode": "0775",

"owner": "ansibleusers",

"path": "/tmp/data1",

"size": 4096,

"state": "directory",

"uid": 1025

}

What about the output of the following command:

ansible all -ku root -m setup