Re: [ansible-project] Try to put 1 Ansible facts from multiple servers into one list

2020-04-18 Thread Stefan Hornburg (Racke)
On 4/18/20 1:57 AM, Gregory Skelton wrote: > I feel this should be easy.  > > I'm trying to put a fact I set on each server into one central list.  > sat_id is the Big List > sat_id_raw is the variable that I set earlier in the automation.  > > What am I missing here? > Thanks in advance > Try

Re: [ansible-project] how to use suexec su in ansible

2020-04-18 Thread Stefan Hornburg (Racke)
On 4/18/20 1:19 AM, Pradeep Tiwari wrote: > Hi All, > > I did look at various privilege escalation tools available but i dont see > suexec listed there. Could you please guide me how to achieve this become > method > You would need to find or write a custom become plugin for suexec: https://d

[ansible-project] How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Samir Kothawade
Hi, *Here is the brief about scenario: * 1. login to Debian host machine using ansible 2. Go to corresponding directory where the binary is and execute that binary. (This binary is written in c and C++. After execution it ask for the userid & password) 3. After login into that binary's shell,

[ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Samir Kothawade
Also, There is a limitation on remote host - It does not have xrandr module. So, changing screen size with xrandr will not be available :( On Saturday, 18 April 2020 14:45:18 UTC+5:30, Samir Kothawade wrote: > > Hi, > > *Here is the brief about scenario: * > > 1. login to Debian host machine u

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Stefan Hornburg (Racke)
On 4/18/20 11:50 AM, Samir Kothawade wrote: > Also, There is a limitation on remote host - It does not have xrandr module. > So, changing screen size with xrandr will > not be  available :( You need to configure the size of the remote terminal, so xrandr won't be the correct tool. So you can tr

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Karl Auer
How exactly are the stats output on the host? If the programs that produce them send them to standard output, then one option would be to run the commands and redirect their outputs to a file. When all the programs have been run, copy that file to wherever you need it. Remember to append for all b

[ansible-project] Failed to lock apt for exclusive operation

2020-04-18 Thread George James
I create a new user using ansible called `nginx`, `nginx` is part of the sudo group a, but when I try to do an apt install with this user I get the below error ``` : FAILED! => {"changed": false, "msg": "Failed to lock apt for exclusive operation"} ``` What is the cause of the error and how c

Re: [ansible-project] Failed to lock apt for exclusive operation

2020-04-18 Thread Stefan Hornburg (Racke)
On 4/18/20 2:05 PM, George James wrote: > I create a new user using ansible called `nginx`, `nginx` is part of the sudo > group a, but when I try to do an apt > install with this user I get the below error  > > ``` > : FAILED! => {"changed": false, "msg": "Failed to lock apt for exclusive > oper

Re: [ansible-project] Failed to lock apt for exclusive operation

2020-04-18 Thread George James
Hi Stefan, I have attached my playbook below - name: Install Nginx Ubuntu hosts: web remote_user: "{{ NGINX_USER }}" become: yes become_method: sudo become_user: "{{ NGINX_USER }}" connection: ssh gather_facts: no vars: NGINX_VERSION: nginx-1.17.10 NGINX_SBIN_PATH: /usr/

Re: [ansible-project] Failed to lock apt for exclusive operation

2020-04-18 Thread Stefan Hornburg (Racke)
On 4/18/20 3:13 PM, George James wrote: > Hi Stefan, I have attached my playbook below > > Hello George, you need to be superuser to install APT packages, but your become_user is "{{ NGINX_USER }}" which is probably not root. Regards Racke > | > > > -name:InstallNginxUbuntu >   host

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Samir Kothawade
On Saturday, 18 April 2020 15:46:06 UTC+5:30, Karl Auer wrote: > > How exactly are the stats output on the host? > *Actual Output received in stats.txt file though method which is I am using.* "OPR>display debug info PP ip 192.168.30.26 port 8686 data", "\u001b[H\u001b[JSending comm

Re: [ansible-project] Failed to lock apt for exclusive operation

2020-04-18 Thread George James
Okay, sorry I am new to Ansible and all this is a bit confusing. How do I set the super password, because now I change it to root, and even though I use the flag --ask-pass and pass in the password I now get the error `Missing sudo password` - name: Install Nginx Ubuntu hosts: web remote_us

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Samir Kothawade
As shown, there is some garbage data coming that file, we can remove that using regex. My initial objective it to capture all 500 stats lines in variable - stats On Saturday, 18 April 2020 19:08:32 UTC+5:30, Samir Kothawade wrote: > > > > On Saturday, 18 April 2020 15:46:06 UTC+5:30, Karl Auer

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Samir Kothawade
H[i, I tried with stty but that could not help. output remained the same. Here is how i used that : - hosts: opr gather_facts: no tasks: - name: set the winsize shell: stty cols 500 rows 500 - name: Get the debug status ignore_errors: yes ...and kept rest script same. On

Re: [ansible-project] Failed to lock apt for exclusive operation

2020-04-18 Thread Stefan Hornburg (Racke)
On 4/18/20 3:41 PM, George James wrote: > Okay, sorry I am new to Ansible and all this is a bit confusing. > > How do I set the super password, because now I change it to root, and even > though I use the flag --ask-pass and pass in > the password I now get the error `Missing sudo password` > H

[ansible-project] Task Status at Playbook runtime

2020-04-18 Thread Ashish Sagar
Hi Folks, Is there anyway to get specific Task status like Changed, ignored or failed during Playbook runtime in synchronous mode ? Thanks Ashish -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop recei

Re: [ansible-project] Failed to lock apt for exclusive operation

2020-04-18 Thread Dick Visser
On Sat, 18 Apr 2020 at 15:41, George James wrote: > > Okay, sorry I am new to Ansible and all this is a bit confusing. > > How do I set the super password, because now I change it to root, and even > though I use the flag --ask-pass and pass in the password I now get the error > `Missing sudo pa

[ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Samir Kothawade
>> Could you please explain how can use xterm command : xterm --tn dumb -cm -dc -e this is your command Fustratigly, xterm is not present in remote machine and I am not allowed to install xterm utility on targeted remote machine. Still, is there any way to run it through ansible conroller?

Re: [ansible-project] Task Status at Playbook runtime

2020-04-18 Thread Stefan Hornburg (Racke)
On 4/18/20 4:24 PM, Ashish Sagar wrote: > Hi Folks, > > Is there anyway to get specific Task status like Changed, ignored or failed > during Playbook runtime in synchronous mode ? > > > Thanks > Ashish Sorry, but your question is not clear. Please elaborate and/or illustrate it with an exampl

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Karl Auer
What shell are you using on the remote machine? And what kind of terminal is it running in? I have a suspicion that it is just running on a pty, and that your program is blindly putting out control sequences. If it is, then there's nothing you can do about it except strip them using regexp or simil

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Karl Auer
You *might* be able to convince the console on the remote system to be a dumb terminal by doing this as your command: TERM-dumb ; sh -c your_command This works in gnome-terminal as well - it seems to suppress most control sequences except CR/LF and similar. Or in Ansible, setting the environment

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Samir Kothawade
bash: TERM-dumb: command not found. gnome-terminal utility not available on remote machine On Sat, 18 Apr 2020 at 21:53, Karl Auer wrote: > You *might* be able to convince the console on the remote system to be a > dumb terminal by doing this as your command: > > TERM-dumb ; sh -c your_comman

Re: [ansible-project] Task Status at Playbook runtime

2020-04-18 Thread Jean-Yves LENHOF
Hi, Register a variable for the module you call and after test this variable... More info here : https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#rc Example on a change (first link in google) : https://raymii.org/s/tutorials/Ansible_-_Only-do-something-if

Re: [ansible-project] Task Status at Playbook runtime

2020-04-18 Thread Ashish Sagar
Sure, By default, Ansible playbook executes tasks in sequence and summarize task results at last. With this approach, it shows each task status on running playbook verbose logs. Question is, Is there anyway to get task status like failed, changed etc during playbook runtime (without parsing logs)

Re: [ansible-project] Try to put 1 Ansible facts from multiple servers into one list

2020-04-18 Thread Gregory Skelton
Many thanks, I'll give it a try. Greg On Saturday, April 18, 2020 at 2:43:16 AM UTC-5, Stefan Hornburg (Racke) wrote: > > On 4/18/20 1:57 AM, Gregory Skelton wrote: > > I feel this should be easy. > > > > I'm trying to put a fact I set on each server into one central list. > > sat_id is t

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Tony Wong
Hi why is it when i run this playbook I get this error tony@ubuntu:~/ansiblework$ ansible-playbook vmware_tools.yml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' ERROR! no action detected in task. This often indicate

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Jorge Rúa
That error message often indicates an indentation issue or a missing module parameter. On Sat, Apr 18, 2020, 20:22 Tony Wong wrote: > Hi > > why is it when i run this playbook I get this error > > tony@ubuntu:~/ansiblework$ ansible-playbook vmware_tools.yml > [WARNING]: provided hosts list is e

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Dick Visser
That module was introduced in ansible 2.5: https://docs.ansible.com/ansible/latest/modules/vmware_guest_powerstate_module.html Do you run an older version? On Sat, 18 Apr 2020 at 20:22, Tony Wong wrote: > Hi > > why is it when i run this playbook I get this error > > tony@ubuntu:~/ansiblework

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Tony Wong
this is the playbook --- - name: get info vm hosts: localhost connection: local gather_facts: false tasks: - name: get info about the virtual machine vmware_guest_info: hostname: vcnerter username: administrator@vsphere.local password:

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Jean-Yves LENHOF
Please as said by another people here, respect indentations stricly ! vmware_guest_info& name have not the same indentation as written by A. Kasurde Regards, JYL Le 18/04/2020 à 22:14, Tony Wong a écrit : this is the playbook --- - name: get info vm   hosts: localhost   connection: local

[ansible-project] Re: Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread David Foley
hosts: localhost gather_facts: false tasks: - vmware_guest_info: hostname: "{{ vcenter_hostname }}" username: eu\wavesservice password: GHb!DW|79Z5i validate_certs: no datacenter: Test name: "{{ VM_Name }}" schema: "vsphere" properties: ["runti

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread David Foley
--- - name: get info vm hosts: localhost connection: local gather_facts: false tasks: - name: get info about the virtual machine vmware_guest_info: hostname: vcnerter username: password: datacenter: DC validate_certs: False name: myvm

[ansible-project] Module name not misspelled, but didn't exist yet

2020-04-18 Thread Dick Visser
Hi The "misspelled module name" issue seems to be a recurring one. In the majority of cases the spelling is actually correct, it's just that that module didn't exist yet in the version of ansible that raises the error. These days the error is slightly improved: https://github.com/ansible/ansible/

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Tony Wong
what editor can i use on my ubuntu box? I cant use anything other than vim. still getting the error. tony@ubuntu:~/ansiblework$ ansible-playbook info.yml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' ERROR! Syntax Er

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Tony Wong
On Sat, Apr 18, 2020 at 1:42 PM Tony Wong wrote: > what editor can i use on my ubuntu box? I cant use anything other than > vim. > > > still getting the error. > > tony@ubuntu:~/ansiblework$ ansible-playbook info.yml > [WARNING]: provided hosts list is empty, only localhost is available. > Note

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread David Foley
you missing* " - " * On Saturday, April 18, 2020 at 9:46:14 PM UTC+1, Tony Wong wrote: > > > > On Sat, Apr 18, 2020 at 1:42 PM Tony Wong > > wrote: > >> what editor can i use on my ubuntu box? I cant use anything other than >> vim. >> >> >> still getting the error. >> >> tony@ubuntu:~/ansibl

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread David Foley
Why Aren't you using your Local Machine using Atom or VS Code to build your Yaml files then using WinSCP copy the playbooks over ? On Saturday, April 18, 2020 at 9:43:00 PM UTC+1, Tony Wong wrote: > > what editor can i use on my ubuntu box? I cant use anything other than > vim. > > > still get

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Tony Wong
this is what i have. but still not working On Sat, Apr 18, 2020 at 1:55 PM David Foley wrote: > Why Aren't you using your Local Machine using Atom or VS Code to build > your Yaml files then using WinSCP copy the playbooks over ? > > On Saturday, April 18, 2020 at 9:43:00 PM UTC+1, Tony Wong wrot

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Dick Visser
What does 'ansible --version' say? On Sat, 18 Apr 2020 at 23:26, Tony Wong wrote: > this is what i have. but still not working > > On Sat, Apr 18, 2020 at 1:55 PM David Foley wrote: > >> Why Aren't you using your Local Machine using Atom or VS Code to build >> your Yaml files then using WinSCP

[ansible-project] Ansible-playbook

2020-04-18 Thread Orkhan Mammadov
Hi guys, I have created file under /etc/sudoers.d/ directory with this entry: ansible ALL=(ALL) NOPASSWD:ALL and copied to managed hosts in order to install some service such as vsftpd on those hosts. I can ssh and install any service with root user, but not with ansible user. It gives the fol

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Karl Auer
TERM=dumb Sorry, I mistyped. The minus sign should have been an equals sign. The idea is to set the environment variable TERM to the value "dumb" immediately before starting the shell in which your program will be run. Also can you please answer the question about whether you can redirect the ou

Re: [ansible-project] Ansible-playbook

2020-04-18 Thread James Cassell
On Sat, Apr 18, 2020, at 6:13 PM, Orkhan Mammadov wrote: > Hi guys, > > I have created file under /etc/sudoers.d/ directory with this entry: > ansible ALL=(ALL) NOPASSWD:ALL and copied to managed hosts in order to > install some service such as vsftpd on those hosts. > > I can ssh and install

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Samir Kothawade
On Sun, 19 Apr 2020 at 05:24, Karl Auer wrote: > TERM=dumb > > Sorry, I mistyped. The minus sign should have been an equals sign. > > >> >> Can you please help me where I can use this in my code and see the content in a text file ? Here is my anible code...pasting it here again *-** hosts: sam*

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Kiran Kumar
Thanks Abhijeet ! On Friday, April 17, 2020 at 1:26:53 AM UTC-7, Abhijeet Kasurde wrote: > > --- > - hosts: localhost > vars_files: > - vcenter_vars.yml > vars: > vm_list: > - test01 > tasks: > - name: Get information about the virtual machine > vmware_guest_info: > validate_certs: False > hostna

Re: [ansible-project] Check status of VMware tools & reboot if VMware tools are not running

2020-04-18 Thread Kiran Kumar
Use https://onlineyamltools.com/validate-yaml This will help you validate the syntax On Saturday, April 18, 2020 at 2:26:10 PM UTC-7, Tony Wong wrote: > > this is what i have. but still not working > > On Sat, Apr 18, 2020 at 1:55 PM David Foley > wrote: > >> Why Aren't you using your Local Mac

Re: [ansible-project] Re: How to change remote hosts' terminal screen size/resolution in Ansible

2020-04-18 Thread Stefan Hornburg (Racke)
On 4/19/20 8:25 AM, Samir Kothawade wrote: > > Hello Samir, this is now really off topic. Try to figure out to wrangle the data out of this rather unhelpful binary by means of "expect" or similar software, but your problem is not related to Ansible. Regards Racke > On Sun, 19 Apr 2