[ansible-project] Re: Windows service recovery on failure with ansible?

2020-05-07 Thread Jordan Borean
It was added witht he PR https://github.com/ansible-collections/ansible.windows/pull/40 which is the 'win_service' module in the ansible.windows collection. This collection is officially meant to be the source of supported Windows module in Ansible 2.10 and onwards but you might be able to use

Re: [ansible-project] Create user with ssh key, error deploying key

2020-05-07 Thread Dick Visser
parsekey IndexError: list index out of range Pretty much says it - something is wrong with the pubkey, in the sense that the authorized_key module can parse it (see modules/system/authorized_key.py). LIkely something with the options of the pubkey, their quoting, or something with comments (#)?

Re: [ansible-project] If unreachable - stop giving Failed out and move to next host

2020-05-07 Thread Dick Visser
Out of interest - what is the reason they are unreachable? On Fri, 8 May 2020 at 00:17, Work-Hard wrote: > > Hi, > Is it possible for the host that if it's unreachable - stop giving Failed > output and move to the next task. As of now, it just shows the output fails. > > > --- > - hosts:

Re: [ansible-project] Create user with ssh key, error deploying key

2020-05-07 Thread Michael Mullay
Perhaps your ssh key file is somehow malformed? What happens if you go old-school and use ssh-copy-id to try to copy over the key file that way? At least you'll know if it's a problem with your key or the playbook (and if it works with ssh-copy-id of course you can just delete it off the target

[ansible-project] If unreachable - stop giving Failed out and move to next host

2020-05-07 Thread Work-Hard
Hi, Is it possible for the host that if it's unreachable - stop giving Failed output and move to the next task. As of now, it just shows the output fails. --- - hosts: amazonlinux2 become: true serial: 1 max_fail_percentage: 0 ignore_errors: true gather_facts: false

[ansible-project] Re: How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread David Foley
Using the Example Curl -X you can use the Ansible URI Module curl -X POST http://developer:developer@localhost:8080/job/test/buildWithParameter --data-urlencode json='{"parameter": [{"name":"paramA", "value":"123"}]}'--- - name: Jenkins Remote Build hosts: localhost connection:

Re: [ansible-project] Create user with ssh key, error deploying key

2020-05-07 Thread Joe G
> > I appreciate the suggestion though I don't believe that is the solution to >> my problem, right? I suppose I should have posted the actual playbook I'm >> working with. The one previously provided was just a test one. > > Here's the task yml file within the role - include_vars:

[ansible-project] Re: How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread Mimo
it is not clear how to make the params as input there, it is easy to make it through Jenkins pipelines, but I am using Ansible, so I am expecting to have a Jenkins module that will build a job in Jenkins (or in my case handle the params to already existing job in Jenkins On Thursday, May 7,

[ansible-project] Re: How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread Mimo
so I aam expecting to have a jenkins module that will have a params that will be passed to the already existing Jenkins Job and it will triggerit On Thursday, May 7, 2020 at 10:02:20 PM UTC+2, David Foley wrote: > > Hi, > > In order to push jobs from Ansible or even Python to Jenkins you need to

[ansible-project] Re: How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread Mimo
it is not clear how to make the params as input there, it is easy to make it through Jenkins pipelines, but I am using Ansible, so I am expecting to have a Jenkins module that will build a job in Jenkins (or in my case handle the params to already existing job in Jenkins) On Thursday, May 7,

Re: [ansible-project] How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread Mimo
can you explain in more details please? it is not clear to me On Thu, May 7, 2020 at 10:02 PM David Foley wrote: > Hi, > > In order to push jobs from Ansible or even Python to Jenkins you need to > make sure Remote Trigger is enable and an API Token has been created for > your Jenkins User. You

[ansible-project] Re: Windows service recovery on failure with ansible?

2020-05-07 Thread 'J Hawkesworth' via Ansible Project
I thought someone had added recovery actions to win_service module, but maybe that PR never got finished, or I am confused with dependent services. I think you would have to use script module and some powershell to set recovery actions. You could maybe use sc.exe too if you are in a hurry,

[ansible-project] How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread David Foley
Hi, In order to push jobs from Ansible or even Python to Jenkins you need to make sure Remote Trigger is enable and an API Token has been created for your Jenkins User. You can Then just use a Post request using the Ansible URI module -- You received this message because you are subscribed

[ansible-project] How to pass params from Ansible to Jenkins Job triggered by Ansible Playbook?

2020-05-07 Thread Mimo
Hello everyone, I checked Ansible documentation, I did not find answers there or anywhere of how I can pass params to the Jenkins Job,so these params should be as an input params to this Jenkins Job and they will be used in that Job, So is there a way to make this happen? Thank you already

Re: [ansible-project] Create user with ssh key, error deploying key

2020-05-07 Thread Michael Mullay
Joe, If the path to the ssh key is in the current Role, you could just write is as: key="{{ lookup('file', 'files/joe_id_rsa.pub') }}" state=present If that doesn't work I would try putting the key in the same directory as the playbook and just do:

[ansible-project] Windows service recovery on failure with ansible?

2020-05-07 Thread vinod devops
Hi Friends, How do I set windows service recovery on. failure, suppose x service stopped due to failure, it needs to started automatically by creating recovery condition with. ansible windows service? How do I do that ? Thanks vinod -- You received this message because you are subscribed

[ansible-project] ansible error: msg: 'An unhandled exception occurred while templating' in regex_replace

2020-05-07 Thread Meir Yanovich
i have this task which should create random dir download file to the random dir but I keep getting an error on the regexp : --- - name: check if exists hosts: localhost gather_facts: false tasks: - debug: msg:

[ansible-project] Create user with ssh key, error deploying key

2020-05-07 Thread Joe G
Need help with the error I'm getting trying to create users with ssh keys. It creates the user fine but when it comes time to deploy the ssh key it fails. I've tried this using a couple different playbooks and both similarly error out. I believe this was the online guide I followed. I've

Re: [ansible-project] Ansible lininfile behavior

2020-05-07 Thread Kai Stian Olstad
On Thu, May 07, 2020 at 02:22:54PM -0400, Justin Nelson wrote: > I just wanted to say thanks for your help in pointing out where I went > wrong. Setting the play that was contending for a single file to serial: 1 > did the trick. When our ansible controller gets upgraded to 2.9 I'll use > throttle

Re: [ansible-project] Ansible lininfile behavior

2020-05-07 Thread Justin Nelson
Kai, I just wanted to say thanks for your help in pointing out where I went wrong. Setting the play that was contending for a single file to serial: 1 did the trick. When our ansible controller gets upgraded to 2.9 I'll use throttle to limit just that one task. Everything is working as expected,

[ansible-project] Re: include_vars - variable is not Serializable

2020-05-07 Thread Robert Wagner
Never mind - I had a typo that was leading to a not-helpful error message. Thanks, Rob On Thursday, May 7, 2020 at 10:34:53 AM UTC-6, Robert Wagner wrote: > > Hi all. Wondering if somebody can point me in the right direction - Google > has led me on bit of a wild goose chase. > > I'm using

[ansible-project] include_vars - variable is not Serializable

2020-05-07 Thread Robert Wagner
Hi all. Wondering if somebody can point me in the right direction - Google has led me on bit of a wild goose chase. I'm using ansible 2.9.6 on CentOS 7.7. I have some vaulted vars that if I put in vars/main.yml work fine. If I move the same vars to another file and include it (include_vars:

Re: [ansible-project] rpm--import issues

2020-05-07 Thread Dick Visser
Hi No problem. So the 'ansible way' is to use native modules wherever possible. The shell/command task should be used only if there is no reasonable way to achieve things using native modules. In your case the ansible way could look something like this: tasks: - name: Find RPM GPG keys

[ansible-project] Include Vars, with_items , returned data with .results values

2020-05-07 Thread Adam McGill
I am using a include_vars file to pipe the variable to a libary/ps1/py file which will return results / verification. Is there a way to not include the item data /ansible loop information in the .results data. As I figured the .results data should only include the data I pipe back from the

Re: [ansible-project] unable to ssh

2020-05-07 Thread Dick Visser
Ansible is an automation tool that uses SSH as its transport. Before automating things, make sure you can manually connect to the device using SSH: https://docs.ansible.com/ansible/latest/user_guide/connection_details.html Fixing SSH problems is not in scope for this list, but in this case the

[ansible-project] Include Vars / With_items / returned data options

2020-05-07 Thread Adam McGill
I am using a include_vars file to pipe the variable to a libary/ps1/py file which will return results / verification. Is there a way to not include the item data /ansible loop information in the .results data. As I figured the .results data should only include the data I pipe back from the

[ansible-project] aireos_config with prompts

2020-05-07 Thread Scott Fella
Hello everyone, Wanted to see if someone has a fix for what I'm trying to do. First off, the aireos_command allows for "prompt" and "answer", but the aireos_config does not. I have tried using the following: ""/r/ny/r/n ""//r//ny//r//n ""//ry//r

Re: [ansible-project] Adding task output to a file in a loop

2020-05-07 Thread Vladimir Botka
On Wed, 6 May 2020 12:41:54 -0700 (PDT) harry devine wrote: > for uid in {1000..6500} > user = ipa user-find --uid=$uid --raw |grep uid: | awk '{print $2}' > echo "user,uid" >> uid.csv > do This is the Ansible equivalent, I think. The module "getent" creates the dictionary "getent_passwd".

[ansible-project] unable to ssh

2020-05-07 Thread Hitesh Kumar
Hi All I am facing ssh connection issues with my network switch, need help to establish ssh connection root@VPC260:/etc/ansible# ssh 10.25.200.1 Unable to negotiate with 10.25.200.1 port 22: no matching key exchange method found. Their offer:

[ansible-project] Re: fortigate / fortinet

2020-05-07 Thread Andrew Meyer
Here is what I am getting: ansible -m ping 10.150.1.1 --user=ansible [WARNING]: sftp transfer mechanism failed on [10.150.1.1]. Use ANSIBLE_DEBUG=1 to see detailed information [WARNING]: scp transfer mechanism failed on [10.150.1.1]. Use ANSIBLE_DEBUG=1 to see detailed information 10.150.1.1 |

[ansible-project] Cisco interface state change

2020-05-07 Thread sayantan laha
Dear all, I am newbie in ansible. My requirment is like when i see an interface in suspended mode want to bring back to UP for all cisco device. Please help how do i apply conditional way. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To

Re: [ansible-project] rpm--import issues

2020-05-07 Thread Quad Zero
Apologies to you also Racke. Thank you for pointing this out. On Thursday, May 7, 2020 at 2:02:31 AM UTC-4, Stefan Hornburg (Racke) wrote: > > On 5/7/20 1:01 AM, Quad Zero wrote: > > Thanks for your reply but really is not helpful bud. > > > > This is like if i asked how i can get to a

Re: [ansible-project] rpm--import issues

2020-05-07 Thread Quad Zero
Hi Dick, Yes, so I may have replied to your comment above in my reply back to Michael. I guess my knowledge on Ansible is still very new, so currently just getting things done, until I get to grips with better understanding. Could anyone please recommend any good books that covers most of

Re: [ansible-project] rpm--import issues

2020-05-07 Thread Quad Zero
Hi Michael, So I did search all the modules. My question was how to import all the keys from the /etc/pki... all i could find was individual loads, it was so that I run multiple CentOS and RedHat servers and some have different repos enabled, so bulk import would be a better solution I

Re: [ansible-project] Directories create twice

2020-05-07 Thread Quentin Aveno
Hi, thanks for your response. I don't really understand this behavior. It's probably a syntax error (trailing slash or something like that, as you mentioned) I ended up using : - name: "Look for all files in services" find: paths: "{{ local_tmp_dir.path }}" file_type:

Re: [ansible-project] Adding task output to a file in a loop

2020-05-07 Thread harry devine
Each time through the loop, will the registered output overwrite the previous values? Harry On Wed, May 6, 2020 at 11:51 PM Brian Coca wrote: > I would use a template , you can use the registered results in a for > loop inside jinja2. > > > > -- > -- > Brian Coca > > -- > You

Re: [ansible-project] how can i execute the following oracle sql commands using ansible and get the value back to be stored in variable

2020-05-07 Thread Jean-Yves LENHOF
Hi, Perhaps, you should have a look on these : https://github.com/oravirt/ansible-oracle https://github.com/oravirt/ansible-oracle-modules A lot of works has been done here If you don't want all of these, a step in the right direction here :

[ansible-project] Re: how can i execute the following oracle sql commands using ansible and get the value back to be stored in variable

2020-05-07 Thread vishal natekar
Hey, wondering if you found the solution to this. On Wednesday, February 28, 2018 at 10:58:21 AM UTC, Gopi Krishna wrote: > > HI, > > MY playbook: > > sample.sh: > . /u05/oracle/VISEBS/12.1.0/VISEBS_sal-devtl10.env > val='v$archived_log' > R=`sqlplus '/as sysdba'< set numw 1 lines 80 pages 0; >

Re: [ansible-project] Directories create twice

2020-05-07 Thread Dick Visser
without actually looking into it, this does sound very much like a (missing) trailing slash issue somewhere On Thu, 7 May 2020 at 11:00, Quentin Aveno wrote: > > Hello ! > > I have an issue concerning modules find then copy (with relpath filter) > > I have a role : > - name: "Test" > hosts:

Re: [ansible-project] Problem using when condition for empty variable

2020-05-07 Thread Vladimir Botka
On Thu, 7 May 2020 02:25:16 -0700 (PDT) דודו דודו wrote: > Using domain_name | default("") == "" skip the task no matter if i have > value or not This is not what I see. Both the comparison to an empty string and testing the length should work. For example hosts: localhost tasks: -

[ansible-project] Re: vmotion condition

2020-05-07 Thread Mani
Real-time memory and datastore calculation using the pre-defined module for VMware.Please provide if this is achievable in Ansible or not. Thanks, Mani On Thursday, 30 April 2020 00:26:53 UTC+5:30, Mani wrote: > > I am trying to perform vmotion of multiple VMs between 2 ESXi hosts using > the

Re: [ansible-project] Problem using when condition for empty variable

2020-05-07 Thread Vladimir Botka
On Thu, 7 May 2020 02:25:16 -0700 (PDT) דודו דודו wrote: > Using domain_name | default("") == "" skip the task no matter if i have > value or not Compare the lenght to 0 then when: domain_name|default("")|length == 0 -- You received this message because you are subscribed to the

Re: [ansible-project] How to assign random name for vmware snapshot?

2020-05-07 Thread Mani
Thank you, Abhijeet. That worked!! On Thursday, 7 May 2020 14:16:53 UTC+5:30, Abhijeet Kasurde wrote: > > You can use filters - > https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html > > Either - "{{ hostname | to_uuid }}" or "{{ '%Y_%m_%d_%H_%M_%S' | strftime > }}" > > On

Re: [ansible-project] Problem using when condition for empty variable

2020-05-07 Thread דודו דודו
Using domain_name | default("") == "" skip the task no matter if i have value or not On Thursday, May 7, 2020 at 11:42:03 AM UTC+3, Stefan Hornburg (Racke) wrote: > > On 5/7/20 10:35 AM, דודו דודו wrote: > > i have a variable (domain_name) located on external YML file, > > I wish to run a

Re: [ansible-project] Problem using when condition for empty variable

2020-05-07 Thread דודו דודו
when using *domain_name|default("")|length > 0 *and the paramter is empry i'm geeting the follwoing error message. When the parameter include value it is working fatal: [10.164.237.140]: FAILED! => {"msg": "The conditional check 'domain_name | default(\"\") | length > 0' failed. The

[ansible-project] Re: "failed to open a SFTP connection (Garbage packet received)"

2020-05-07 Thread Dave Hodgkinson
Never mind. .bashrc was outputting something and that blew sftp up. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[ansible-project] Directories create twice

2020-05-07 Thread Quentin Aveno
Hello ! I have an issue concerning modules find then copy (with relpath filter) I have a role : - name: "Test" hosts: localhost vars: archive_name: "/opt/archive.tgz" local_tmp_dir: path: "/tmp/tmp" dest_directory: "" tasks: - name: "[Module] Download and unarchive

[ansible-project] "failed to open a SFTP connection (Garbage packet received)"

2020-05-07 Thread Dave Hodgkinson
I'm tring to run our corporate ansible setup on my FC31 laptop. In the "staging" configuration, main.yml, I have hosts: localhost. My ssh key is in root's authorized_keys file. I run and get: ansible-playbook main.yml PLAY [Common tasks (various inc auth, firewall and update)]

Re: [ansible-project] Problem using when condition for empty variable

2020-05-07 Thread Vladimir Botka
> when: domain_name | default("") == "" Don't compare to empty string. Test the length instead https://github.com/ansible/ansible-lint/blob/master/lib/ansiblelint/rules/ComparisonToEmptyStringRule.py when: domain_name|default("")|length > 0 -- You received this message because you are

Re: [ansible-project] How to assign random name for vmware snapshot?

2020-05-07 Thread Abhijeet Kasurde
You can use filters - https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html Either - "{{ hostname | to_uuid }}" or "{{ '%Y_%m_%d_%H_%M_%S' | strftime }}" On Thu, May 7, 2020 at 2:00 PM Mani wrote: > I am a newbie to ansible and I am trying to take a snapshot of multiple >

Re: [ansible-project] Problem using when condition for empty variable

2020-05-07 Thread Stefan Hornburg (Racke)
On 5/7/20 10:35 AM, דודו דודו wrote: > i have a variable (domain_name) located on external YML file,  > I wish to run a task in case the variable is empty.   From some reason, it is > always skipping no matter if i have a > value or not  > You are doing a string test on an undefined variable,

[ansible-project] Problem using when condition for empty variable

2020-05-07 Thread דודו דודו
i have a variable (domain_name) located on external YML file, I wish to run a task in case the variable is empty. From some reason, it is always skipping no matter if i have a value or not *External Yaml* domain_name: ldap_server_hostname: 10.168.233.77 # Ip can be used as well

[ansible-project] How to assign random name for vmware snapshot?

2020-05-07 Thread Mani
I am a newbie to ansible and I am trying to take a snapshot of multiple VM's with a random snapshot name including the VM name (vmname + random number or timestamp). I am able to take snapshot using the VM name with the below code: --- - name: Gather all registered virtual machines

Re: [ansible-project] rpm--import issues

2020-05-07 Thread Stefan Hornburg (Racke)
On 5/7/20 1:01 AM, Quad Zero wrote: > Thanks for your reply but really is not helpful bud. > > This is like if i asked how i can get to a destination, you are telling me to > go to a train or bus station. > That was a bad move from you if you ask me. Regards Racke > > On Wednesday,