[ansible-project] Unable to get remote target hostname when using delegate_to

2020-03-25 Thread Shifa Shaikh
Below playbook gets the disk usage percentage of '/tmp' from a list of remote_hosts [20 remote servers] and stores it locally (delegate_to) in a file {{ playbook_dir }}/tmpfiles/stats.yml --- hosts: remote_hosts tasks: - name: Generate JSON data lineinfile: path: "{{

[ansible-project] Using Ansible to query Splunk logs

2020-03-25 Thread jdh239
I am coming up short on this, but wondering if anyone has tried, or has recommendations for querying error logs stored in Splunk with Ansible? The reason is to push the query load to the Splunk servers and not the production servers. Thanks in advance. -- You received this message because

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Kai Stian Olstad
On Wed, Mar 25, 2020 at 09:27:40PM +0200, patrick patra wrote: > hello everyone can someone help me with documentatiions on ansible network > automation > (routers,switches,..) > for example if i want to make a LAN then i want to deploy configurations > automatically with ansible playbooks > >

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread patrick patra
hello everyone can someone help me with documentatiions on ansible network automation (routers,switches,..) for example if i want to make a LAN then i want to deploy configurations automatically with ansible playbooks thanks to help me am just a biginner Le mer. 25 mars 2020 à 21:10, Kai Stian

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Kai Stian Olstad
On Wed, Mar 25, 2020 at 09:54:07AM -0700, Shifa Shaikh wrote: > @Kia Hi, > > As suggested I tried > > item.size_total instead of item.size_available > > "{{ ansible_host }}_{{ item.mount }}: {{ (100 * ((item.size_total - > item.size_available) / item.size_total)) | round(1, 'common') }}" >

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Dan Linder
I'd suggest putting a debug showing you the three numbers Ansible is using for item.size_total and item.size_available. As @klingac mentioned, it could be that the values that ""df -k" reports or uses in it's computation aren't the exact same ones that Ansible uses. For instance, using the

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread klingac
It could be this kind of problem http://linuxshellaccount.blogspot.com/2008/12/why-du-and-df-display-different-values.html `df` reads only and trusts completely to superblocks. Another reason could be, that you can have other running process that can keep a deleted file open. Do you have

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Shifa Shaikh
@Kia Hi, As suggested I tried item.size_total instead of item.size_available "{{ ansible_host }}_{{ item.mount }}: {{ (100 * ((item.size_total - item.size_available) / item.size_total)) | round(1, 'common') }}" but it still gives me 22.2 % value instead of 19% Can you please let me

Re: [ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Kai Stian Olstad
On Wed, Mar 25, 2020 at 07:15:51AM -0700, Shifa Shaikh wrote: > > "{{ ansible_host }}_{{ item.mount }}: {{ (100 * ((item.size_total - > item.size_available) / item.size_available)) | round(1, 'common') }}" That is not how you calculate percentage, you need to divide on item.size_total and

Re: [ansible-project] Awall activate hangs

2020-03-25 Thread Andrew Duty
$ ansible --version ansible 2.9.6 config file = ~/repos/ansible/ansible.cfg configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = ~/.local/lib/python3.7/site-packages/ansible executable location =

[ansible-project] Unable to get correct disk space utilized percentage using Ansible API

2020-03-25 Thread Shifa Shaikh
Here is the output of df -k from the target server: # df -k > Filesystem 1K-blocks Used Available Use% Mounted on > devtmpfs 1905280 0 1905280 0% /dev > tmpfs 1922024 0 1922024 0% /dev/shm > /dev/sda1 1942528 295616 1646912 16% /boot > /dev/mapper/OMT-home 15718400 832120 14886280 6% /home >

[ansible-project] Unable to get correct disk usage percentage using Ansible API

2020-03-25 Thread Shifa Shaikh
Here is the output of df -k from the target server: ok: [myhostone] => (item={u'block_used': 2857014, u'uuid': > u'3fa1ec29-aca5-476b-8041-6a7bc6b1efc2', u'size_total': 52701921280, > u'block_total': 12866680, u'mount': u'/ihs', u'block_available': 10009666, > u'size_available':

RE: [ansible-project] Re: Create AWS EFS

2020-03-25 Thread sandy.hung
� I check this pip3 and python is installed, but still same error I don’t know how to solved it. � � � BR Sandy � From: ansible-project@googlegroups.com On Behalf Of Dick Visser Sent: Wednesday, March 25, 2020 4:02 PM To: ansible-project@googlegroups.com Subject: Re:

Re: [ansible-project] Re: Create AWS EFS

2020-03-25 Thread Stefan Hornburg (Racke)
On 3/25/20 9:18 AM, sandy.h...@abagile.com wrote: > In user  ldap  should be use “root” > > Use command line > > sudo apt-get install pip3 > > sudo pip3 install boto3 > It is possible that Ansible uses Python 2 on the target. To enforce Python 3 on the target, you can set the following

RE: [ansible-project] Re: Create AWS EFS

2020-03-25 Thread sandy.hung
In user ldap should be use “root” Use command line sudo apt-get install pip3 sudo pip3 install boto3 � � BR Sandy � From: ansible-project@googlegroups.com On Behalf Of Dick Visser Sent: Wednesday, March 25, 2020 4:02 PM To: ansible-project@googlegroups.com Subject: Re:

Re: [ansible-project] Re: Create AWS EFS

2020-03-25 Thread Dick Visser
How exactly did you install boto3? As what user etc On Wed, 25 Mar 2020 at 08:52, Sandy Hung wrote: > ansible 2.9.4 > config file = /etc/ansible/ansible.cfg > configured module search path = [u'/home/ldap/.ansible/plugins/modules', > u'/usr/share/ansible/plugins/modules'] > ansible

[ansible-project] Re: Create AWS EFS

2020-03-25 Thread Sandy Hung
ansible 2.9.4 config file = /etc/ansible/ansible.cfg configured module search path = [u'/home/ldap/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/dist-packages/ansible executable location = /usr/bin/ansible python

Re: [ansible-project] Create AWS EFS

2020-03-25 Thread Dick Visser
It means that your boto3 is not available to ansible. Wrong location? Different venv? What does 'ansible --version' say? On Wed, 25 Mar 2020 at 08:07, Sandy Hung wrote: > Dear All: > > I have create efs ansible , I have install boto3 > this is show error msg > > this is my ansible > --- > -

[ansible-project] Create AWS EFS

2020-03-25 Thread Sandy Hung
Dear All: I have create efs ansible , I have install boto3 this is show error msg this is my ansible --- - hosts: localhost connection: local gather_facts: no vars_files: - ec2key.yml tasks: - name: Create EFS efs: state: present