Re: [ansible-project] change user to a debian package

2020-09-22 Thread Stefan Hornburg (Racke)
On 9/22/20 11:10 AM, Johana Galarza Monta wrote: > I am trying to install a debian pacakge and change the user with become_user > but it seems not working, the error it says > that "No package is available" but it is available > >   - name: Install rules > apt: >   name:-rules={{ 

Re: [ansible-project] Reading partial string

2020-09-21 Thread Stefan Hornburg (Racke)
On 9/21/20 7:49 AM, dudu.c...@gmail.com wrote: > Hi, > > I have a simple playbook that takes an IP address from the input file and > update this IP including hostname under > /etc/hosts. > > The problem is that in the input file the IP is written with subnet – > 1.1.1.1/24 > > While I need

Re: [ansible-project] Ansible set_fact with with_items always prints last item

2020-09-21 Thread Stefan Hornburg (Racke)
On 9/21/20 7:12 AM, kumare...@gmail.com wrote: > Hi Brae, > > Thanks for the help was able to get the desired output.But the output are in > same line is there way to print new line > for each service? > > TASK [debug] >

Re: [ansible-project] Ansible set_fact with with_items always prints last item

2020-09-19 Thread Stefan Hornburg (Racke)
On 9/19/20 12:29 PM, kumare...@gmail.com wrote: > Hi Experts, > > I am looking to capture certain service status using ansible the problem is > debug prints only last item.Below is the > expected output. > > Hostname : test > > httpd --> Running > ntpd  --> Running > > Below are the playbook.

Re: [ansible-project] Sending email with results

2020-09-15 Thread Stefan Hornburg (Racke)
On 9/15/20 2:36 PM, Sandy Toshev wrote: > > Thank you for the fast response, > > So I added the following at the end of the .yml file, but I guess I do not > know the correct syntax, because I get an error. > #added from suggestion >   - name: Sending an email about it >     mail: >       body:

Re: [ansible-project] Variables based on conditions

2020-09-15 Thread Stefan Hornburg (Racke)
On 9/15/20 10:20 AM, Yantram Cloud wrote: > is there a way i can include only those variables which are defined in a task. > for example: in below task, i want to include disk_encryption_key only when > its passed from the user. else i want to > exclude. > basically i know we can include tasks

Re: [ansible-project] Need help with Ansible loop

2020-09-13 Thread Stefan Hornburg (Racke)
On 9/12/20 1:52 PM, Sky7 wrote: > Sure, > > So i have excel file from where I am reading the file and populating the > variables files called iterate.yaml which puts > it in  dictionary of list with each excel row values as a list of elements > > Iterate.yaml > -- > data: >   - Name: person1 >  

Re: [ansible-project] Need help with Ansible loop

2020-09-12 Thread Stefan Hornburg (Racke)
On 9/11/20 11:18 PM, Sky7 wrote: > Hi All, > > I have following code to call another file find_elements.yaml from my current > playbook. > > calling from my current playbook > - include: find_elements.yaml >   loop: >       -"{{ vardata.L2.0 }}" >       -"{{ vardata.L2.1 }}" >       --"{{

Re: [ansible-project] Can I throttle a task with delay?

2020-09-11 Thread Stefan Hornburg (Racke)
On 9/11/20 10:50 AM, tterr...@gmail.com wrote: > I have an inventory containing a few dozens hosts. > > I have a short playbook that configures a monitoring service on a single > server. I build the contents of a per host > config for the monitoring service and then I upload it to the monitoring

Re: [ansible-project] Ansible hangs on package installation for hours before connection to host is lost

2020-09-11 Thread Stefan Hornburg (Racke)
On 9/10/20 6:37 PM, Pankaj Basnal wrote: > This playbook works with less number of hosts. As the number of hosts > increase the probability of error increases. There > are a few runs which have completed successfully with less number of hosts. > Though I don't have logs for them. > I'll take

Re: [ansible-project] Ansible hangs on package installation for hours before connection to host is lost

2020-09-10 Thread Stefan Hornburg (Racke)
On 9/10/20 5:29 PM, Pankaj Basnal wrote: > Hi, > I'm new to ansible and I'm facing an issue with executing our playbook.  > > Setup- > * For 10 hosts on azure > * all hosts are identical and newly created > * ansible.cfg-  >     [defaults] >           host_key_checking = False > > * portion of

Re: [ansible-project] How to search through a JSON output for a specific key:value?

2020-09-09 Thread Stefan Hornburg (Racke)
On 9/9/20 9:45 AM, alber...@gmail.com wrote: > Abhijeet, > > thanks for that, it looks interesting, but I would like to try to see if > there is a solution with as minimal extra > libraries needed. Trying to keep it within the Ansible sphere & use > Ansible/Jinja2 filters or regex as much as

Re: [ansible-project] iterate counter within loop

2020-09-08 Thread Stefan Hornburg (Racke)
On 9/8/20 5:15 PM, Stefan Hornburg (Racke) wrote: > On 9/7/20 1:36 PM, David Bush wrote: >> Hi All, >> >> I am after some advise please as I am struggling to think of a method to do >> this. >> >> I have a task in a role that needs to create a file

Re: [ansible-project] iterate counter within loop

2020-09-08 Thread Stefan Hornburg (Racke)
On 9/7/20 1:36 PM, David Bush wrote: > Hi All, > > I am after some advise please as I am struggling to think of a method to do > this. > > I have a task in a role that needs to create a file on each target host in a > host-group that should look like this: >   > server.0=:1234 > server.1=:1234

Re: [ansible-project] Re: Usage of a registered variable in "when" condition

2020-09-08 Thread Stefan Hornburg (Racke)
On 9/8/20 1:47 PM, pan...@hotmail.de wrote: > I tried this, but it just gives me error: > "The conditional check 'inventory_hostname == redundancynode' failed. The > error was: error while evaluating conditional > (inventory_hostname == redundancynode): 'redundancynode' is undefined" You have to

Re: [ansible-project] Re: Usage of a registered variable in "when" condition

2020-09-08 Thread Stefan Hornburg (Racke)
On 9/8/20 1:20 PM, Peter Gebirgslok wrote: > I dont know how to edit my post, but there is also no typo in the when > condition > > this i how the when condition looks like. > > when: inventory_hostname == "redundancynode" > You can't edit your post of course. Change that line to: when:

Re: [ansible-project] Usage of a registered variable in "when" condition

2020-09-08 Thread Stefan Hornburg (Racke)
On 9/8/20 1:13 PM, pan...@hotmail.de wrote: > Hello guys, > > I have the following problem: > I'm reading a simple json file which contains some names of my hosts. > The file looks like this: >  {  "redundancynode": "node4", "service": "dhcp", "servicenode" "node1" } > > Now i have a task to

Re: [ansible-project] Trying to background a start up script

2020-09-03 Thread Stefan Hornburg (Racke)
On 9/3/20 2:07 PM, Sebastian Collins wrote: > Hi, > > I have this task and I can't for the life of me get it to keep the process > running. I have added in some debug and it > shows me the process is getting shutdown almost immediately after it is > started up as can be seen by the end time in

Re: [ansible-project] Error:a bug: 'utf8' codec can't decode byte 0xa0 in position 588

2020-09-01 Thread Stefan Hornburg (Racke)
On 9/1/20 2:12 PM, erdivay singhal wrote: > This is the only error show after running the yaml > So how does your playbook look like? What's the complete output of the task in error? Regards Racke > On Tue, Sep 1, 2020, 5:26 PM Stefan Hornburg (Racke) <mailto:ra...@linuxi

Re: [ansible-project] Error:a bug: 'utf8' codec can't decode byte 0xa0 in position 588

2020-09-01 Thread Stefan Hornburg (Racke)
On 9/1/20 1:17 PM, erdivay singhal wrote: > Hi Team, >  Any idea for the below mentioned error  > > Error:a bug: 'utf8' codec can't decode byte 0xa0 in position 588 No idea due to missing context. Regards Racke > > -- > You received this message because you are subscribed to the

Re: [ansible-project] Help with async tasks.

2020-08-31 Thread Stefan Hornburg (Racke)
On 8/31/20 11:38 AM, Guannan Sun wrote: > Dear Tech Team, > > I'm Guannan from China. I'm new to Ansible and looking for some technical > help. > Actually I'm looking for a method to execute one role in parallel with loops > of different configuration files. For > example, I want to create 100

Re: [ansible-project] URI module keeps erroring

2020-08-25 Thread Stefan Hornburg (Racke)
On 8/25/20 5:39 PM, Ingrum Jefferson wrote: > Hi Group, > > I have been stuck for a few days on this issue; I am not sure whether it is a > defect or not. > Hello Ingrum, Your playbook isn't correctly formatted, is should look like - hosts: all tasks: - name: display ip ranges

Re: [ansible-project] hostvars[inventory_hostname][ansible_facts] when host unreachable?

2020-08-25 Thread Stefan Hornburg (Racke)
On 8/24/20 3:23 PM, Trammael wrote: > I've been trying to loop on a fact for all hosts ('distribution') and > encountered an error to the effect of 'dict is > undefined' .  It took  a while to realize that 'ansible_facts:' exists but is > unpopulated on unreachable hosts. > > What would be the

Re: [ansible-project] question about mode=preserve with file module

2020-08-20 Thread Stefan Hornburg (Racke)
On 8/20/20 9:34 PM, Martey Dodoo wrote: > Hi everyone, > > I'm having some issues using the "mode" parameter on the file module > > to change ownership of an existing > directory without modifying its permissions.

Re: [ansible-project] Display file content in body of mail module

2020-08-15 Thread Stefan Hornburg (Racke)
On 8/15/20 12:33 PM, Sivaraman P wrote: > The file is present in the target machine. whether lookup will not work there. > Lookups are always done on the controller. You could retrieve the file from the target machine with the "fetch" module. Regards Racke -- Ecommerce and Linux

Re: [ansible-project] Re: 2 levels nested loop with variables

2020-08-13 Thread Stefan Hornburg (Racke)
On 8/13/20 8:00 PM, Nick-H wrote: > so, I have been trying with lookup('dict')  but still not quite close to the > expected result  > I get: " An unhandled exception occurred while running the lookup plugin > 'dict'. Error was a 'ansible.errors.AnsibleError'>, original message: with_dict

Re: [ansible-project] What privilege required for an ansible user able to configure a server

2020-08-13 Thread Stefan Hornburg (Racke)
On 8/13/20 5:33 PM, Edison Wang wrote: > Hi Luca:  > >    I've added that command become: yes like you and Stefan said, and make my > playbook as simple as below for a test. But > after I run this playbook where I didn't see any error, I still couldn't see > the new user "edison" created on

Re: [ansible-project] What privilege required for an ansible user able to configure a server

2020-08-13 Thread Stefan Hornburg (Racke)
On 8/13/20 2:30 PM, Edison Wang wrote: > Hi There, > > I am pretty new in this domain and got a question to ask. My goal is to > create a new user "edison" on a Ubuntu server. > Now I've already had a user "manager" which is able to ssh to this Ubuntu > server. This problem I got is after I run

Re: [ansible-project] how to share variables between hosts

2020-08-13 Thread Stefan Hornburg (Racke)
On 8/13/20 1:49 PM, Gabriel Sousa wrote: > i have this: > > --- > - hosts: all >   vars: >   - site: "{{ ansible_hostname | regex_replace('^(.{2}).*' ,'\\1' ) }}" >   - datavg: DATAVG >   - datavgpvs: /dev/sdb >   - lv_int: >     - { lv: app, size: "{{appS}}", vg: "{{datavg}}", fs: xfs, mount:

Re: [ansible-project] Re: Ansible failing to manage influxdb

2020-08-11 Thread Stefan Hornburg (Racke)
On 8/11/20 2:54 PM, Hrvoje Gašpar wrote: > Could you check versions of influxdb and python you are running on managed > host? > > Influx should be between versions 0.9 and 1.2.4, while python needs to be > version 2.6: >

Re: [ansible-project] play book execution error

2020-08-10 Thread Stefan Hornburg (Racke)
On 8/10/20 5:49 PM, A wrote: > Hi Mates, I am getting below error while executing playbook for a new server > that needs to be added . > > TASK [krb5_workstation : install krb5_workstation package from > rhel-x86_64-server-7-datacenter] >

Re: [ansible-project] How to change form ssh username/password to public key encryption in a playbook?

2020-07-29 Thread Stefan Hornburg (Racke)
On 7/29/20 1:30 PM, Hans IJ wrote: > Hi, > > I am a beginner with ansible; I couldn't find the answer yet. > I want to bootstrap virgin raspberry pi's (raspbian based); > > It all works fine as intended, except for one step,  > I have to change the ansible hosts file manually half way between

Re: [ansible-project] Reduce debug task

2020-07-29 Thread Stefan Hornburg (Racke)
On 7/29/20 9:58 AM, Rahul Kumar wrote: > Hi Ansible Gurus, > Is it possible to print some message in the task itself when condition is not > matched , rather than having new task with > debug module ? > > Example: currently i am writing two tasks: >  - name: Get Active Application server >      

Re: [ansible-project] pass playbook vars to a python script

2020-07-29 Thread Stefan Hornburg (Racke)
On 7/28/20 10:40 PM, Jerry Hwang wrote: > hello, > > I am trying to have a python script (auto triggered when a playbook is run) > to take from playbook extra_vars and uses it > as var for the script. > > for example: > ansible-playbook test.yml --extra-vars "win=True" > > something like in

Re: [ansible-project] Need help

2020-07-28 Thread Stefan Hornburg (Racke)
checked before the task file is loaded. However, you probably can use them in a failed_when: condition. Regards Racke > > On Tue, 28 Jul 2020 at 13:33, Stefan Hornburg (Racke) <mailto:ra...@linuxia.de>> wrote: > > On 7/28/20 9:56 AM, Rahul Kumar wrote: &

Re: [ansible-project] Need help

2020-07-28 Thread Stefan Hornburg (Racke)
> On Tue, 28 Jul 2020 at 12:56, Stefan Hornburg (Racke) <mailto:ra...@linuxia.de>> wrote: > > On 7/28/20 9:20 AM, Rahul Kumar wrote: > > Ya stephan , it is bad approach I know ( Infact we should avoid > ignore_errors as much as possible) ! But all tasks >

Re: [ansible-project] Need help

2020-07-28 Thread Stefan Hornburg (Racke)
g depends on it? Regards Racke > So i need to , can we do that ? > > On Tue, 28 Jul 2020 at 12:44, Stefan Hornburg (Racke) <mailto:ra...@linuxia.de>> wrote: > > On 7/28/20 9:01 AM, Rahul Kumar wrote: > > Hi Ansible Gurus, > > I have a playbook like

Re: [ansible-project] Need help

2020-07-28 Thread Stefan Hornburg (Racke)
On 7/28/20 9:01 AM, Rahul Kumar wrote: > Hi Ansible Gurus, > I have a playbook like below: > - name: Get Active Rest server >       include_role: >         name:  web-server >         tasks_from: active-rest-server > > Now I have a playbook under the web-server role named active-rest-server.yml !

Re: [ansible-project] Re: Working around lookup plugin limitation with environment variables

2020-07-24 Thread Stefan Hornburg (Racke)
On 7/24/20 7:44 PM, Nico H wrote: > not sure if that needs new topic but I see that other AWS modules also fail > to pickup variables in Environment as they > should . > You are sure these environment variables are lowercase? Usually they are uppercase, like AWS_ACCESS_KEY. Ansible just

Re: [ansible-project] Help needed regarding when condition

2020-07-24 Thread Stefan Hornburg (Racke)
e result.content.allstarted only > when result.failed== false  in until clause ! > > On Fri, 24 Jul 2020 at 13:05, Stefan Hornburg (Racke) <mailto:ra...@linuxia.de>> wrote: > > On 7/24/20 9:14 AM, Rahul Kumar wrote: > > my idea is: i don't want t

Re: [ansible-project] Help needed regarding when condition

2020-07-24 Thread Stefan Hornburg (Racke)
> > So it doesn't make sense to use "result" there as it is registered > *after* running the task. > > What is the idea behind your condition? > > Regards >         Racke > > > > > On Fri, 24 Jul 2020 at 12:34, S

Re: [ansible-project] Help needed regarding when condition

2020-07-24 Thread Stefan Hornburg (Racke)
;my_instances_config" *before* running the task. So it doesn't make sense to use "result" there as it is registered *after* running the task. What is the idea behind your condition? Regards Racke > > On Fri, 24 Jul 2020 at 12:34, Stefan Hornburg (Racke) <mai

Re: [ansible-project] Help needed regarding when condition

2020-07-24 Thread Stefan Hornburg (Racke)
On 7/24/20 8:59 AM, Rahul Kumar wrote: > Hi Ansible Gurus,, > I have this output: >   (1, '\r\n{"msg": "service[component] - https://myip/myrest/v1/ fails > to due to error 501 - None", "failed": > true, "invocation": {"module_args": {"url_password": null, "tasks": [{"name": > null, "hostname":

Re: [ansible-project] working with file

2020-07-22 Thread Stefan Hornburg (Racke)
On 7/22/20 10:18 AM, steveni...@hotmail.fr wrote: > Hi, > > I have a json file-> cluster_name.json : > ["cluster1","cluster2","cluster3","cluster4"] > > And I want to iterate on every cluster name to obtain some informations so I > use the module vmware_host_service_info. > My playbook is ->

Re: [ansible-project] Ansible Remote Versioning

2020-07-22 Thread Stefan Hornburg (Racke)
On 7/22/20 9:36 AM, Firesh Bakhda wrote: > Hi JYL, > > This is a great insight you have provided. That would certainly a good way on > how to manipulate the Ansible and Ansible > Tasks on each runs.  > What what it doesn't solve is that how do i populate that fact file with > Tasks that has

Re: [ansible-project] How to verify col C is always double of Col D in ansible.

2020-07-21 Thread Stefan Hornburg (Racke)
it in ansible. And the task which produces this output is? Regards Racke > > > Best Regards > Jenisha T > Whatsapp: +91 07598087866 > > > > > > On Tue, 21 Jul 2020 at 19:45, Stefan Hornburg (Racke) <mailto:ra...@linuxia.d

Re: [ansible-project] How to verify col C is always double of Col D in ansible.

2020-07-21 Thread Stefan Hornburg (Racke)
On 7/21/20 4:11 PM, Jenisha T wrote: > Hi Team > > The output shown in image  is stored in the register variable. How to verify > the value in col C is double the value in > col D and Col E value is always 2 and verify Col F is syncd > > https://imgur.com/rZXeHUg;>

Re: [ansible-project] How to create function call in ansible

2020-07-21 Thread Stefan Hornburg (Racke)
On 7/21/20 2:47 PM, Gajendra Gaikwad wrote: > Why you are using ls -l command and > For checking user group use below  command > # id username | grep -i groupname > > Regard  > Gg That's pretty much off topic as this is not a group about shell scripts. You should be able to replace ls with the

Re: [ansible-project] Help on uri module

2020-07-21 Thread Stefan Hornburg (Racke)
egards Racke > On Tue, 21 Jul 2020, 14:01 Stefan Hornburg (Racke), <mailto:ra...@linuxia.de>> wrote: > > On 7/20/20 8:38 PM, Gajendra Gaikwad wrote: > > Hello All, > > I would like to fetch some data using uri module, but little concern is > th

Re: [ansible-project] Help on uri module

2020-07-21 Thread Stefan Hornburg (Racke)
On 7/20/20 8:38 PM, Gajendra Gaikwad wrote: > Hello All, > I would like to fetch some data using uri module, but little concern is that > uri module should wait for 30 second to > complete to load the page (page has same dynamic data which required 30 > second to load (asp) ) > How does the

Re: [ansible-project] lineinfile using insertafter

2020-07-17 Thread Stefan Hornburg (Racke)
On 7/17/20 10:21 PM, 'Chris Bidwell - NOAA Federal' via Ansible Project wrote: > Hey all, > > Trying to insert a line to multiple instances in the same file.   > > I tried insertafter but that only put in one spot.  Here's the code: > >     - name: add proxy to zabbix.repo if needed >      

Re: [ansible-project] Working around lookup plugin limitation with environment variables

2020-07-17 Thread Stefan Hornburg (Racke)
ult(None) - name: > myrole2, when: somethingElse | default(None) > environment: AWS_ACCESS_KEY_ID: "{{ assumed_role.sts_creds.access_key }}" > AWS_SECRET_ACCESS_KEY: "{{ > assumed_role.sts_creds.secret_key }}" AWS_SECURITY_TOKEN: "{{ > assumed_role.sts_creds.session_token }}" | > &

Re: [ansible-project] environment proxy variable not working

2020-07-17 Thread Stefan Hornburg (Racke)
On 7/17/20 6:53 PM, 'Chris Bidwell - NOAA Federal' via Ansible Project wrote: > Hey all, > > I'm having an issue trying to get ansible to use my environment variable to > pull through a proxy server. > > Running: ansible 2.9.10 > > Here's my variable declarations: > > --- > - name: puppet5 >  

Re: [ansible-project] Working around lookup plugin limitation with environment variables

2020-07-17 Thread Stefan Hornburg (Racke)
On 7/17/20 12:05 AM, Nico H wrote: > Hey, have you ever find a solution here ?  > I face the same problem  trying to pass my sts credentials in environment for > a role, like this :  > > > pre_tasks : > >     - name: Assume role >       sts_assume_role: >         role_arn:

Re: [ansible-project] Save output to text file

2020-07-16 Thread Stefan Hornburg (Racke)
On 7/15/20 10:36 PM, Tcpip wrote: > Hello , > > I tried with this configuration  > > - name: SAVE OUTPUT TO FILE >       copy: >         content: "{{ enviro.results[0].stdout }}" >         dest: "/root/playbooks/results/{{ inventory_hostname }}-space.txt" >       tags: save > > But still having

Re: [ansible-project] Re: remove mysql

2020-07-15 Thread Stefan Hornburg (Racke)
On 7/15/20 6:55 PM, Tony Wong wrote: > this was the original install and I am just trying to reverse the installs > > What is the distribution and the release of the target server(s)? Regards Racke > --- > - hosts: all >   become: true >   vars_files: >     - vars/default.yml >

Re: [ansible-project] remove mysql

2020-07-15 Thread Stefan Hornburg (Racke)
On 7/15/20 5:38 PM, Tony Wong wrote: > trying to remove mysql from a previous install > > -- > - hosts: all >   become: true >   vars_files: >     - vars/default.yml > >   tasks: >   - name: Uninstall MySQL packages. >     apt: name={{ item }} state=absent >     with_items: >       -

Re: [ansible-project] ansible check and diff mode not working

2020-07-15 Thread Stefan Hornburg (Racke)
On 7/15/20 10:08 AM, Shyam Sunder wrote: > Thanks for reply. Yes below is my intended config - > | > ntp server 10.19.70.1 > | > > But on device we have different ntp server configured - > | > ntp server 10.19.60.9 > | > * > Here in updates section, ansible guiding me that its going to push this

Re: [ansible-project] installing flatpaks

2020-07-09 Thread Stefan Hornburg (Racke)
On 7/9/20 11:14 PM, Andrew Meyer wrote: > I am trying to install a list of flatpaks on my Fedora Workstation and > getting the following errors when I run my playbook: > > | > TASK [Installthe flatpak packages fromflathub forcurrent >

Re: [ansible-project] Re: expect "Press enter to continue"

2020-07-08 Thread Stefan Hornburg (Racke)
On 7/8/20 12:19 PM, ritesh0...@gmail.com wrote: > Hi Stefano,  > > Is it necessary to install Pexpect on remote machine as well? > > Thanks & Regards, > Ritesh Gupta. Yes, see the module documentation: https://docs.ansible.com/ansible/latest/modules/expect_module.html Regards Racke >

Re: [ansible-project] Looping CF Templates with items loops and its reporting an error

2020-07-07 Thread Stefan Hornburg (Racke)
On 7/7/20 4:28 PM, ameya agashe wrote: > Thanks, Dick, I did try and it is moving forward. But I think still something > is fundamentally rooted. > > My main.yml looks like below with_file puts the *contents* of each file into {{ item }} So try with_items instead :-) Regards Racke >

Re: [ansible-project] How to split value from list

2020-07-06 Thread Stefan Hornburg (Racke)
On 7/6/20 3:32 PM, Srinivas Naram wrote: > Hello Jenisha, > > Assuming that you are getting this value from /etc/passwd., try to change you > command > >  tail -1 /etc/passwd | awk '{split($0,a,":"); print a[1]}' > cut -d : -f 1 is more concise and readable than your awk command. Otherwise I

Re: [ansible-project] Run Command On Each Host

2020-07-01 Thread Stefan Hornburg (Racke)
On 7/1/20 12:13 PM, 'Jitender J' via Ansible Project wrote: > > Hi how can i access array in shell module trying to access as below but not > getting any output > > >   tasks: > >     - name:  verify that it shows the new cluster ID for this company in > active list and old cluster in

Re: [ansible-project] Looping a task until it succeeds

2020-06-25 Thread Stefan Hornburg (Racke)
ee what's there and create the new record based on that (2 API calls) instead of blindly trying out (1 + n API calls). Regards Racke > > On Thursday, June 25, 2020 at 1:22:23 PM UTC-4, Stefan Hornburg (Racke) wrote: > > On 6/25/20 3:51 PM, Cade Lambert wrote: > > M

Re: [ansible-project] janusgraph script

2020-06-25 Thread Stefan Hornburg (Racke)
output will print in the same consol or is there any particular path? The debug module displays the contents of the given variable below the "run janusgraph script" task. Regards Racke > > On Thu, Jun 25, 2020 at 11:20 AM Stefan Hornburg (Racke) <mailto:ra...@linuxi

Re: [ansible-project] Looping a task until it succeeds

2020-06-25 Thread Stefan Hornburg (Racke)
On 6/25/20 3:51 PM, Cade Lambert wrote: > My use case: we use Infoblox for our DNS.  What I'm trying to do is > automatically create a host record with the next > available hostname that isn't already in DNS.  My plan was to loop through a > formatted hostname, incrementing a number > in that

Re: [ansible-project] unsupported parameter

2020-06-25 Thread Stefan Hornburg (Racke)
On 6/25/20 11:29 AM, Jenisha T wrote: > My Playbook: > --- > - name: test >   gather_facts: yes >   hosts: localhost >   connection: local >   tasks: >     - name: install httpd >       yum: >         name: httpd >         state: present >         when: >           - ansible_distribution ==

Re: [ansible-project] Ansible playbook error when daemon_reload:yes

2020-06-25 Thread Stefan Hornburg (Racke)
On 6/25/20 6:08 AM, ameya agashe wrote: > Hi Guys, > > I am getting the below error as described in StackOverflow post, I would > appreciate guidance as to why it is giving > Connection time out error > >

Re: [ansible-project] janusgraph script

2020-06-24 Thread Stefan Hornburg (Racke)
On 6/25/20 1:01 AM, Rajeeb sahoo wrote: > I am new in ansible project. > > I need to start janusgraph.sh script through ansible. when I am executing it > not giving any error but janusgraph is not > starting. my janusgraph is combining with Cassandra, elasticsearch, and > gramlin server. > >

Re: [ansible-project] Are jinja2 extensions available?

2020-06-21 Thread Stefan Hornburg (Racke)
On 6/21/20 9:50 PM, Nick Kakouros wrote: > Jinja2 documentation mentions some extensions that can be enabled. Are these > available somehow? Can I enable them in > Ansible? > > https://jinja.palletsprojects.com/en/2.11.x/templates/#extensions You can try to add them to the Ansible configuration

Re: [ansible-project] Git clone failing only via Ansible. Working via cmdline.

2020-06-21 Thread Stefan Hornburg (Racke)
On 6/21/20 9:46 AM, Mukuntha rajaa wrote: > Hello, > > When I git clone from cmdline, I am able to clone successfully. But when I do > the same thing via, Ansible, something is > going wrong. > > |git clone g...@gitlab.com:/.git Cloning into ''... remote: > Enumerating objects:

Re: [ansible-project] nested with_items

2020-06-18 Thread Stefan Hornburg (Racke)
On 6/18/20 1:11 PM, Nicholas Britton wrote: > So with that option I would have two more include tasks prior where I set the > the next to vars?   > > Any other options to keep it in one play? > You could also use the product filter

Re: [ansible-project] How to Segregate Inventory file and Group Variable to provide Ansible User name and password

2020-06-17 Thread Stefan Hornburg (Racke)
On 6/17/20 5:07 PM, ditun dhar wrote: > Guys, > > I am new in Ansible and need some help. I am in need of segregating my > inventory file (which will change continuously > based on another script output) with credential file. However Ansible > username, password and admin password will be same

Re: [ansible-project] Conditional with dict2item is falied

2020-06-15 Thread Stefan Hornburg (Racke)
On 6/15/20 9:39 PM, Rafael Tomelin wrote: > > Hi guys, > > I have a task with equal below, but when I validate it is defined it not > recognized. > - name: include vars virtual_machine > include_tasks: virtual_machine.yml > when: > - gms_az_vm_action == 'create_virtual_machine' > -

Re: [ansible-project] ansible tower - command works BUT playbook fails to connect to the host via ssh

2020-06-12 Thread Stefan Hornburg (Racke)
On 6/12/20 5:31 PM, Laci wrote: > In my ansible tower I can execute a command successfully on a remote server, > however when I try to run a playbook I get: > > { >     "msg": "Failed to connect to the host via ssh: Warning: Permanently added > 'hostname,10.1.4.66' (ECDSA) to the list > of

Re: [ansible-project] 'when: item not in' conditional issues?

2020-06-12 Thread Stefan Hornburg (Racke)
On 6/12/20 3:34 PM, Doug OLeary wrote: > Hey; > > I'm trying to execute pvcreate on a disk but would like to ensure I don't run > it on a disk that's already defined.  I > have a short playbook that gathers facts, displays ansible_lvm.pvs.keys() > and then: > > | >   -name:run pvcreate >    

Re: [ansible-project] accessing yaml dictionary in playbook

2020-06-12 Thread Stefan Hornburg (Racke)
On 6/12/20 2:35 PM, Doug OLeary wrote: > Hi > > I have a dictionary of disks in my host vars: > > | > disks: >   sdc: >     dev: sdc >     vg: vg01 >     lv: app >     mp: '/opt/app' >   sdd: >     dev: sdd >     vg: vg02tmp >     lv: shared >     mp: '/opt/app/oracle/shared' > | > > A **very**

Re: [ansible-project] ansible 2.9.4 - task with delegate_to: works, subsequent tasks fail

2020-06-12 Thread Stefan Hornburg (Racke)
On 6/11/20 7:36 PM, Andrew Caldwell wrote: > Hi All, hope this question makes sense. Here goes:  > > Context: I have several automated patching playbooks that rely on > stopping/starting services on windows before patching > a database on Linux. We are using a python script to generate a dynamic

Re: [ansible-project] Re: Ansible Tower - user awx permission

2020-06-10 Thread Stefan Hornburg (Racke)
On 6/10/20 8:58 AM, mcubes cloud wrote: > Anybody to help here ? > Please note that this group is only about Ansible, not Tower or AWX. For the former contact RedHat support. Regards Racke > On Tuesday, 9 June 2020 21:11:32 UTC+5:30, mcubes cloud wrote: > > Hi team, > > I

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Stefan Hornburg (Racke)
       "{{ 'SERVER_NAME: ' + SERVER_NAME }}" > > and > >        mailbody: | >          "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME }}" + > "\\n" >          "{{ 'SERVER_NAME: ' + SERVER_NAME }}" > > On Thu, Jun 4, 2020 at 11:38 AM Stefa

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Stefan Hornburg (Racke)
sday, June 4, 2020 at 10:31:41 AM UTC+5:30, Stefan Hornburg (Racke) > wrote: > > On 6/4/20 6:41 AM, Shifa Shaikh wrote: > > I tried all of these but have no clue to a solution.  > > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +  PRO

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-03 Thread Stefan Hornburg (Racke)
On 6/4/20 6:41 AM, Shifa Shaikh wrote: > I tried all of these but have no clue to a solution.  > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +  PROFILE_NAME + "\n" > + 'SERVER_NAME:' + SERVER_NAME + "\n" + > 'NODE_NAME:' +  NODE_NAME + "\n\n\n\n\" }}" > > mailbody: "{{ mailbody |

Re: [ansible-project] With_items /pass var - string.

2020-06-02 Thread Stefan Hornburg (Racke)
On 6/2/20 5:55 PM, Adam McGill wrote: > I would like to take the value of the var and pass it into with_items and I > am running into an issue / error, how can i > pass just the value into with_items.  If i hardcode and put the value > with_items: {{ small2019 }} in there are no > issues.  Using

Re: [ansible-project] Re: how to use ansible tags with conditional includes?

2020-06-02 Thread Stefan Hornburg (Racke)
On 6/2/20 6:46 PM, misterT1958 wrote: > well I guess the number of replies says it all: I must be trying to do > something the language does not support.  Ansible > conditions operate on "include_vars" - include* statements in ansible are > dynamic.  Similarly, import* statements in > ansible

Re: [ansible-project] An exception occurred during task execution.

2020-06-02 Thread Stefan Hornburg (Racke)
On 6/2/20 3:04 PM, Tony Wong wrote: > why do I keep failing on this copy task? > > TASK [Copying contents to working Directory] > *** > task path:

Re: [ansible-project] PHPIPAM

2020-06-02 Thread Stefan Hornburg (Racke)
On 6/2/20 8:48 AM, Naresh Kasula wrote: > Hi Dick Visser, > > Am fine..thanks for asking and how about  > > I have launched instance(CentOs) in AWS then i have installed PHPIPAM on that > successfully and i have created subnets, > customers, etc. Now want to see the information of subnets by

Re: [ansible-project] partial dictionary merge available?

2020-06-01 Thread Stefan Hornburg (Racke)
On 6/1/20 5:58 PM, Toni Mueller wrote: > > Hi, > > I've just read that there is a way to merge dictionaries, to accumulate > values across the variable hierarchy, but it is supposed to be a very > bad idea. Would it be difficult to allow this merge feature on just a > select number of variables?

Re: [ansible-project] How to efficiently 'delegate_to'?

2020-06-01 Thread Stefan Hornburg (Racke)
On 6/1/20 5:49 PM, Toni Mueller wrote: > > Hi, > > in a project to provision stuff, I would like to set a lot of variables > on a host, which I want to use in a playbook, but take the values for > that variable from the host I am delegating to. Ie, in my inventory, I > have > > > host2

Re: [ansible-project] How to copy directory recursively using pattern to remote machine?

2020-06-01 Thread Stefan Hornburg (Racke)
On 6/1/20 1:49 PM, Ankit wrote: > Hello All, > > I have got the following playbooks where i am trying to copy directories and > all its contents recursively which is > present in project repo. For identifying the correct directory, i am using a > variable which holds the pattern value. For >

Re: [ansible-project] Re: how to execute python script using ansible, python script running on different sub-directory under same project folder

2020-05-28 Thread Stefan Hornburg (Racke)
On 5/28/20 9:37 PM, aditya govindaraju wrote: > The issue still there, so I have moved the playbook file to the same > directory where python script is running ex: /reports/ > > So both playbook and python script is in the same folder. But still, I get a > couple of errors. > > Below is my

Re: [ansible-project] SSH in shell command

2020-05-28 Thread Stefan Hornburg (Racke)
On 5/28/20 5:53 PM, Sivaraman P wrote: > I am new to ansible, i have the script in the remote machine and the script > name is ssh.sh which contains below lines to ssh into some another server and > run the script, > > ssh @${server} "sh /tmp/script.sh" > > the question is if i use shell

Re: [ansible-project] Unsupported parameters for (yum) module: enabled

2020-05-28 Thread Stefan Hornburg (Racke)
On 5/28/20 3:16 PM, sarang khulape wrote: > tasks: >   -  name: Start and enable vmtoolsd >      yum: name=vmtoolsd state=started enabled=yes > > How to resolve below error ? > > fatal: []: FAILED! => {"changed": false, "msg": "Unsupported > parameters for (yum) module: enabled Supported >

Re: [ansible-project] Re: how to execute python script using ansible, python script running on different sub-directory under same project folder

2020-05-27 Thread Stefan Hornburg (Racke)
On 5/27/20 2:43 PM, aditya govindaraju wrote: > After i added delegate_to:localhost, playbook ran successful but 'ignored' > with no output. > > Output error: > > fatal: [switch1 -> localhost]: FAILED! => { >     "changed": false,  >     "invocation": { >         "module_args": { >            

Re: [ansible-project] Re: how to execute python script using ansible, python script running on different sub-directory under same project folder

2020-05-27 Thread Stefan Hornburg (Racke)
On 5/27/20 1:20 PM, aditya govindaraju wrote: > Please find the below error message > > The full traceback is: > WARNING: The below traceback may *not* be related to the actual failure. >   File >

Re: [ansible-project] how to execute python script using ansible, python script running on different sub-directory under same project folder

2020-05-27 Thread Stefan Hornburg (Racke)
On 5/27/20 12:31 PM, aditya govindaraju wrote: > Am trying to write a playbook in order to execute a python script running on > a different subdirectory under the same > project folder > > A python script running on - /home/{username}/project1/reports/test1.py > > And playbook running on -

Re: [ansible-project] Vm mount iso and install vmware tools

2020-05-26 Thread Stefan Hornburg (Racke)
On 5/26/20 3:09 PM, Tony Wong wrote: > any idea why this is failing? Syntax is right as far as I can tell > That tells me that your prowess in reading error messages is somewhat limited :-). As per documentation: use dest parameter instead of destination. Regards Racke > > TASK

Re: [ansible-project] Using variable to compare stdout parameter

2020-05-26 Thread Stefan Hornburg (Racke)
On 5/26/20 9:15 AM, Sivakumar Saravanamuthu wrote: > OK here it is.  > > I have build a server X expecting all the parameter are in place.  > > During validation and qualification phase the user who didn't build that > server has to cross check parameter using > simple playbook to make sure

Re: [ansible-project] unable to generate backup file with registered variable in ansible

2020-05-25 Thread Stefan Hornburg (Racke)
with_items: "{{mount_points}}" > register: file > * debug: > var: file.results["stdout"] > > > Output: > "file.results["stdout"]": "VARIABLE IS NOT DEFINED!: 'list object' has no > attribute 'stdout'"   > > >

Re: [ansible-project] unable to generate backup file with registered variable in ansible

2020-05-25 Thread Stefan Hornburg (Racke)
On 5/25/20 10:42 AM, Sadanand Alegaonkar wrote: > hello Stefan, > > I have to add more task in the playbook, that's why i going with this methods. That is hardly a good reason, especially without further explanation. Regards Racke > > On Mon, 25 May 2020 at 10:46,

Re: [ansible-project] AWX (ansible tower) yum module extra variables

2020-05-24 Thread Stefan Hornburg (Racke)
On 5/24/20 9:20 PM, Jerry Hwang wrote: > Hi, > > I am trying yum module on AWX (ansible tower). > AWX -> Inventories -> Run command -> select module: yum etc. > > In the "EXTRA VARIABLES" section on AWX WebUI, what I should put in yaml if I > want to install wget for example. > I have tried to

<    1   2   3   4   5   6   7   8   >