[ansible-project] Re: Debug output as copy source

2024-05-28 Thread Dimitri Yioulos
[SOLVED] Answered my own question, and, to simple really. Hope it helps someone: *- name: Backup all known_hosts files shell: cp -p {{ item }} {{ item }}.bak loop: '{{ known.stdout_lines }}' tags:- known* On Tuesday, May 28, 2024 at 11:42:18 AM UTC-4 Dimitri

[ansible-project] Re: Debug output as copy source

2024-05-28 Thread Dimitri Yioulos
Btw, the error output from the above is: *fatal: [bed-test-9-dy2]: FAILED! => changed=false msg: |-Source /root/.ssh/known_hosts/home/user1/.ssh/known_hosts /home/user2/.ssh/known_hosts/home/user3/.ssh/known_hosts /home/user4/.ssh/known_hosts not foundfatal:

Re: [ansible-project] Re: Is there a task/module to create a vaulted file?

2024-05-28 Thread Andrew Latham
I saw https://github.com/ansible/ansible/pull/79864 which is related. I am interested in this as it sounds useful to many. I wildly assume the solution is obvious. Maybe drop the token into a local dir and a later task can encrypt any files found in said dir and copy them to the vars dir of your

Re: [ansible-project] Re: Is there a task/module to create a vaulted file?

2024-05-28 Thread Dick Visser
On Tue, 28 May 2024 at 15:42, Andrew Latham wrote: > Unable to test from current location but do you need to delegate_to for > this? > Yes, I didn't explicitly mention it, but I'm running all the tasks from a dedicated "local" play with these settings: - name: API tasks hosts: foo_hosts #

Re: [ansible-project] Re: Is there a task/module to create a vaulted file?

2024-05-28 Thread Andrew Latham
Unable to test from current location but do you need to delegate_to for this? On Tue, May 28, 2024 at 7:23 AM Dick Visser wrote: > > > On Tue, 28 May 2024 at 15:17, Dick Visser wrote: > >> >> This seems to work, and because ansible.cfg contains the right >> information (vault_identity_list,

[ansible-project] Re: Is there a task/module to create a vaulted file?

2024-05-28 Thread Dick Visser
On Tue, 28 May 2024 at 15:17, Dick Visser wrote: > > This seems to work, and because ansible.cfg contains the right information > (vault_identity_list, vault_encrypt_identity) the encrypted content looks > good, when I'm debugging. > But the actual file contents are plain text again. It seems

[ansible-project] Re: ansible 2.17 and fortinet.fortios compatibility

2024-05-28 Thread Azadeh Amirhosseini
Update. For those who are interested, i did uninstall ansible-core 2.17.0 and installed 2.16.7 and now it works as expected. On Wednesday, May 22, 2024 at 11:15:16 AM UTC+2 Azadeh Amirhosseini wrote: > Hi all, > > I have installed Ansible Core 2.17.0. My question is, is the Galaxy > collection

Re: [ansible-project] Re: become: true does not work but -b works

2024-05-14 Thread Sameer Modak
Hello Brian, Yes it works , Issue was my role was picking the values from roles directory instead from current directory hence despite making changes at current file become was not working. On Tuesday, May 14, 2024 at 8:12:07 PM UTC+5:30 Brian Coca wrote: > We have tests for this and i just

Re: [ansible-project] Re: become: true does not work but -b works

2024-05-14 Thread Brian Coca
We have tests for this and i just tested manually, become: true on a task does work. Tried with your task (supplying my own values for the vars) and it works the same, putting it on the task, the play, a block, role or command line. The only way i get it to 'not work' is setting ansible_become:

[ansible-project] Re: become: true does not work but -b works

2024-05-14 Thread Sameer Modak
Task which throwing error: name: Create Prometheus install and config directory become: true. <-- does not work file: path: "{{ item }}" state: directory mode: 0755 owner: "{{user}}" group: "{{group}}" loop: - "{{ jmxexporter_jar_path |

[ansible-project] Re: ansible Loop help

2024-05-08 Thread John Harmon
You mean something like this? - name: Run status check pps_check: vm_ip: "{{ item }}" url: "https://bldrapp.sys.comcast.net/api/v3/hosts/status?host-list=; register: status_check with_items: "{{ available_ips }}" async: 900 # Adjust the timeout based

[ansible-project] Re: Create a variable based on a variable

2024-05-08 Thread John Harmon
Just off the top of my head you can use set_fact. - name: Set datacenter variable based on hostname set_fact: datacenter: "datacenter{{ ansible_hostname[-1] }}" when: ansible_hostname | regex_search('^[a-zA-Z0-9]*[1-2]') You can then just use {{ datacenter }} and it should populate

[ansible-project] Re: Create a variable based on a variable

2024-05-08 Thread andregr...@gmail.com
i am quite a newbee with ansible, but i would suggest to a) use host-variables with e.g. "datacenter" set to the matching datacenter value or b) use a regex on the host variable to create the datacenter on it regards, andre Dimitri Yioulos schrieb am Mittwoch, 8. Mai 2024 um 18:34:36 UTC+2: >

[ansible-project] Re: Use docker_login and docker_compose_v2

2024-05-01 Thread Emilio Botero
@felixfontein any pointers? On Tuesday, April 30, 2024 at 3:13:37 PM UTC-4 Emilio Botero wrote: > Hi, > I'm trying to authenticate to my private registry (AWS ECR) and use docker > compose to start my container. I have something like this: > > - name: Create AWS credentials file >

[ansible-project] Re: Can't Use Standard become_method As Have To Use rootsh. Options?

2024-04-26 Thread Nirjas Jakilim
Hi, I have used the wrapper method. but it's giving me the privilege escalation time out error. Ansible Timeout (12s) waiting for privilege escalation prompt Can you please tell me what you have used on the playbook after setting the wrapper? Thanks. On Tuesday, October 24, 2017 at 7:11:15 PM

[ansible-project] Re: Managing postgres functions/tirggers with ansible

2024-04-17 Thread Roland Müller
Hello, I think the postgresql ansible module is for administrating postgresql or enabling the execution of scripts or queries rather then providing a some layer around DDL or DML commands for PostgreSQL. You should be able to use postgresql_query_module or postgresql_script_module for

[ansible-project] Re: Need help in setting ansible for sonicwall backups

2024-04-17 Thread dbs34
Hello! I can offer some advice. In my findings, often there are no vendor canned, provided modules so you have to use the netcommon.cli module which works just as well. I have successfully deployed playbooks for cisco ios, cisco asa, dell, wlcs and nxos. Here is one playbook I use for my asa

[ansible-project] Re: `AttributeError: 'ConnectionError' object has no attribute 'message'` when using the `google.cloud` collection

2024-04-16 Thread 'Reuben Emmens' via Ansible Project
Hi, this is a re-post of this issue - the response time to issues will be a fair bit slower though, so I thought expand the reach to this group. If anyone does have any suggestions, I'll be eternally grateful -- You received

[ansible-project] Re: ipaddr always compresses IPv6 addresses

2024-04-02 Thread Dick Visser
On Tue, 2 Apr 2024 at 21:44, Dick Visser wrote: > Is there a way to keep the original format? > Or a more generic filter that can (de)compress IPv6 addresses? To answer my own question, it seems there is: ipv6form. The docs are mangled though:

[ansible-project] Re: hostname in chroot

2024-03-15 Thread Michael DiDomenico
for what it's worth i figured out a solution to this using namespaces. i'll leave the full script upto the reader, but maybe this will help someone later unshare --uts= chroot /bin/bash once in the new namespace, you can change the hostname and it does not affect the base system, which i

Re: [ansible-project] Re: Is there any Ansible module to Encrypt a log file during the play book execution

2024-03-14 Thread Deepak B K
Hi Drew, I appreciate the suggestion use of ansible.builtin.fetch module instead of copy module and I am trying to use ansible-vault on the command module to encrypt and decrypt the data as you rightly said managing the password secret will be challenge . Ansible-vault has vault

Re: [ansible-project] Re: Is there any Ansible module to Encrypt a log file during the play book execution

2024-03-13 Thread Drew Northup
Hi Deepak, I would suggest using the vault mechanism to securely store the encryption secret if possible, so the process can be fully automated. That will also allow safe storage of any other confidential information needed by the playbook. As for handing of the log files, copy normally only

[ansible-project] Re: Is there any Ansible module to Encrypt a log file during the play book execution

2024-03-12 Thread Deepak B K
Hi Drew, I appreciate your reply . The customer requirement is the secret key should be on ansible controller and the vms /endpoints logs are copied to the controller and encryption is done on the controller I explored copy module has a encrypt option which can help out in the process .

[ansible-project] Re: Is there any Ansible module to Encrypt a log file during the play book execution

2024-03-11 Thread Drew Northup
Hi Deepak, You're going to need a different opener for this can of worms, as Ansible Vault is meant for protecting confidential information that needs to be pushed out to the endpoint being configured and not for pulling information back to the controller for encryption nor is it meant for

[ansible-project] Re: Windows: CS1504 Failed to compile C# code

2024-02-27 Thread Alexander Schomburg
FYI, We managed to find the reason and a possible solution for this issue which is described in detail in this GitHub Issue: https://github.com/ansible-collections/ansible.windows/issues/588 TLDR: Make sure to never enable Dynamic Code Security with AppLocker, even if AppLocker is just run in

[ansible-project] Re: /tmp issue

2024-02-27 Thread Dmitry Konstantinov
https://github.com/ansible/ansible/issues/81777 - looks like an explanation of the issue On Monday 10 October 2022 at 09:22:46 UTC+1 sysadmin-dp wrote: > Hi, > > we also have the same exact problem in our company. This behavior is just > random and everytime we execute the same task again, it

[ansible-project] Re: Windows: CS1504 Failed to compile C# code

2024-02-19 Thread Alexander Schomburg
Another week passed and unfortunately all other Windows 11 PCs we set up during the last week are now affected by the issue too. They've been working on Thursday evening and the issue appeared on Monday morning (for this client, Friday to Sunday are limited working days). Interestingly, we

Re: [ansible-project] Re: Role Handler Separation

2024-02-14 Thread John Petro
I did see that... I have to go back and try it again, but I think it was still reading in all of the handlers for some reason. I did think about just putting the handler in that tasks file too... hadn't yet tried that one, but I am pretty sure that would work too. On Mon, Feb 12, 2024 at 9:32 

[ansible-project] Re: Role Handler Separation

2024-02-12 Thread Vinay Mulugund
This seems similar to something you are looking for: https://stackoverflow.com/questions/75134796/ansible-handlers-per-operating-system-with-same-name On Friday, February 9, 2024 at 5:12:06 AM UTC+5:30 John Petro wrote: > Good Evening... A coworker of mine is working on finishing up a role,

[ansible-project] Re: Role Handler Separation

2024-02-09 Thread Daniel Barros
Would something like that help? --- - name: Playbook Temp hosts: localhost gather_facts: true vars: restart_svcs: Debian: Restart Debian service RedHat: Restart RedHat service handlers: - name: Restart Debian service ansible.builtin.debug: msg: "some

[ansible-project] Re: ansible configuration

2024-02-06 Thread Sakshi Jain
also while executing the playbook from server1 , shall we execute as user1 or user2 ? and in inventory shall i mention as user1 or user2 as in playbook, it needs the privileged permission from the sudo user On Wed, 7 Feb 2024 at 10:35, Sakshi Jain wrote: > So basically two users > > User1 ,

[ansible-project] Re: ansible collection microsoft.ad.ldap inventory

2024-02-05 Thread Todd Lewis
$ ansible-inventory --export --list On Monday, February 5, 2024 at 8:55:28 AM UTC-5 Andy Magana wrote: > So I now I have a working microsoft.ad.ldap.yaml dynamic inventory script. > But my question is how do I export my findings to a person that needs a > list of linux machines based on

[ansible-project] Re: ansible collection microsoft.ad.ldap inventory

2024-02-05 Thread Andy Magana
So I now I have a working microsoft.ad.ldap.yaml dynamic inventory script. But my question is how do I export my findings to a person that needs a list of linux machines based on certain attributes ? Thanks. On Friday, February 2, 2024 at 12:45:13 PM UTC-6 Andy Magana wrote: > [image: Andy

[ansible-project] Re: help with microsoft dynamic inventory

2024-02-05 Thread Andy Magana
So I now I have a working microsoft.ad.ldap.yaml dynamic inventory script. But my question is how do I export my findings to a person that needs a list of linux machines based on certain attributes ? Thanks. On Friday, February 2, 2024 at 12:46:37 PM UTC-6 Andy Magana wrote: > Help with how

[ansible-project] Re: ansible collection microsoft.ad.ldap inventory

2024-02-05 Thread Andy Magana
So I now I have a working microsoft.ad.ldap.yaml dynamic inventory script. But my question is how do I export my findings to a person that needs a list of linux machines based on certain attributes ? Thanks. On Friday, February 2, 2024 at 12:45:13 PM UTC-6 Andy Magana wrote: > [image: Andy

Re: [ansible-project] Re: Multi prompt issue with cisco.ios.ios_command

2024-01-26 Thread Bikram
Hi Smith, Thanks for your suggestions but unfortunately, it's a single command and we cannot split it. I am planning to use the 'ansible.netcommon.cli_command' module instead which has an option to check all conditions and I'm going to test it soon. I find this module more effective than the

[ansible-project] Re: Multi prompt issue with cisco.ios.ios_command

2024-01-26 Thread dbs34
Hi Bikram, You could try splitting the tasks into two seperate tasks and adding a pause. see below. - name: Install new IOS image hosts: cisco_switches tasks: - name: Add IOS image ios_command: commands: - command: install add file flash:cat9k_iosxe.17.09.04a.SPA.bin activate commit

Re: [ansible-project] Re: Error in huge template - how to find the culprit?

2024-01-25 Thread Dick Visser
thx, but that failed on missing filters. In any case, I stripped out al for loops and found the problem. The deployer had commented out list items, but did not leave any. So: foobar: - bar - baz - bor was in the config as: foobar: # - bar # - baz # - bor which meant it wasn't a list

Re: [ansible-project] Re: Error in huge template - how to find the culprit?

2024-01-25 Thread Matt Martz
Line 764 in root is referencing the python code that jinja ultimately generates to run. So there isn't really an easy way to map that back to the template itself. I have a tool that can ingest a jinja template, and print out that python code. It's possible you might be able to visually understand

[ansible-project] Re: Error in huge template - how to find the culprit?

2024-01-25 Thread Dick Visser
with extra debugging: The full traceback is: Traceback (most recent call last): File "/Users/dick.visser/foo/venv/lib/python3.11/site-packages/ansible/template/__init__.py", line 1160, in do_template res = j2_concat(rf) ^ File "", line 764, in root TypeError:

[ansible-project] Re: Elasticache Redis clustered mode

2024-01-25 Thread Musah Zakariah
I could not find a module for elasticache where cluster on, however, I used the command module to create the elasticache, aws elasticache create-replication-group --replication-group-id --cache-parameter-group-name "default.redis7.1.cluster.on" creating a replication group can use the

Re: [EXTERNAL] [ansible-project] Re: Regarding No space left on device error

2024-01-25 Thread Ashok Reddy
Okay Dick and will provide the info . Thanks for your input. On Thu, 25 Jan 2024 at 8:20 PM, Dick Visser wrote: > > > On Thu, 25 Jan 2024 at 11:30, Ashok Reddy wrote: > >> Hi Ehisey, >> >> I have posted the issue, which I have been facing. Sorry for causing >> inconvenience and thanks for your

Re: [EXTERNAL] [ansible-project] Re: Regarding No space left on device error

2024-01-25 Thread Dick Visser
On Thu, 25 Jan 2024 at 11:30, Ashok Reddy wrote: > Hi Ehisey, > > I have posted the issue, which I have been facing. Sorry for causing > inconvenience and thanks for your inputs. > So far it's not even clear where your error occurs. You did not supply basic information such as: * what the

Re: [EXTERNAL] [ansible-project] Re: Regarding No space left on device error

2024-01-19 Thread Ashok Reddy
> > ansible 'TARGET' -m shell -a 'cat /proc/mounts | grep "/home "' > > > > *From:* ansible-project@googlegroups.com > *On Behalf Of *Todd Lewis > *Sent:* Friday, January 19, 2024 11:40 AM > *To:* Ansible Project > *Subject:* [EXTERNAL] [ansible-project] Re:

RE: [EXTERNAL] [ansible-project] Re: Regarding No space left on device error

2024-01-19 Thread 'Hearn, Stan J.' via Ansible Project
o: Ansible Project Subject: [EXTERNAL] [ansible-project] Re: Regarding No space left on device error I've seen "No space left on device" reported when the actual issue was that the filesystem being operated on was mounted read-only rather than read-write. On Thursday, January 18, 2024 at 12:

Re: [ansible-project] Re: Regarding No space left on device error

2024-01-19 Thread Ashok Reddy
Thanks Todd for your inputs. On Sat, 20 Jan 2024 at 12:40 AM, Todd Lewis wrote: > I've seen "No space left on device" reported when the actual issue was > that the filesystem being operated on was mounted read-only rather than > read-write. > > On Thursday, January 18, 2024 at 12:54:29 AM UTC-5

[ansible-project] Re: Regarding No space left on device error

2024-01-19 Thread Todd Lewis
I've seen "No space left on device" reported when the actual issue was that the filesystem being operated on was mounted read-only rather than read-write. On Thursday, January 18, 2024 at 12:54:29 AM UTC-5 Ashok Reddy wrote: > Hi All, > > I have been facing the following issue: > >

Re: [ansible-project] Re: Incomprehensible error message

2024-01-17 Thread Vladimir Botka
On Thu, 18 Jan 2024 12:38:09 +0700 Ian Hobson wrote: > The comma separated list of privileges, cannot have spaces after the > commas. > > This is unusually user-hostile! This was fixed two years ago

[ansible-project] Re: Incomprehensible error message

2024-01-17 Thread Ian Hobson
Found the problem. The comma separated list of privileges, cannot have spaces after the commas. This is unusually user-hostile! Regards Ian On 18/01/2024 11:47, Ian Hobson wrote: Hi All, I am attempting to use Ansible to create a MySQL backup user. It should be able to read and lock

Re: [ansible-project] Re: Issue about defining variable within the task does not work

2024-01-15 Thread ricardo barbosa
Thanks for the tip Evan :) On Sat, Jan 13, 2024 at 1:25 PM Evan Hisey wrote: > Ricardo- > I would also recommend changing how you are sending the json to the > playbook. I have done this a lot in AWS and found it is much cleaner to > either A) use a variable group file, or B) pass it via a

[ansible-project] Re: Issue about defining variable within the task does not work

2024-01-15 Thread ricardo barbosa
Thanks Todd, It worked. So because "delegate_to" the localhost host variables are not available I need to pass the variables with hostvars[ host ], right? Thank you I will correct the entire playbook On Saturday, January 13, 2024 at 12:52:55 PM UTC-4 Todd Lewis wrote: > It's even stranger

[ansible-project] Re: Another report creation problem

2024-01-15 Thread Dimitri Yioulos
Fro what it may be worth, using the yaml stdout_callback, the output of debug looks like this: ok: [myhost] => msg: - paho-c-1.3.13-2.el9 - cpp-11.4.1-2.1.el9 - glibc-headers-2.34-83.el9_3.7 - gnutls-dane-3.7.6-23.el9 - insights-client-3.2.2-1.el9_2 - libblockdev-2.28-7.el9 -

Re: [ansible-project] Re: trying to debug ansible and win_package

2024-01-15 Thread Divan Santana
>> The win_package action failed to execute in the expected time frame (5) >> and was terminated. > The only time this error ever appears is if you have a timeout set on the > task [1]. Check to ensure you don't have that config entry set > 'ansible-config dump --only-changed' or haven't set

Re: [ansible-project] Re: Issue about defining variable within the task does not work

2024-01-13 Thread Evan Hisey
Ricardo- I would also recommend changing how you are sending the json to the playbook. I have done this a lot in AWS and found it is much cleaner to either A) use a variable group file, or B) pass it via a parameter file. Both methods help avoid some of what Todd is referring to. On Sat, Jan 13,

[ansible-project] Re: Issue about defining variable within the task does not work

2024-01-13 Thread Todd Lewis
It's even stranger than that (until you realize what's going on). Rather than commenting out the "ansible_ssh_user:" line, just misspell the variable, like "ansible_ssh_userx". It'll work then, too — but with the wrong user of course. What you're running into is a combination of things:

[ansible-project] Re: trying to debug ansible and win_package

2024-01-12 Thread jbor...@gmail.com
The only time this error ever appears is if you have a timeout set on the task [1]. Check to ensure you don't have that config entry set 'ansible-config dump --only-changed' or haven't set it on the task play. [1]

[ansible-project] Re: error in asnible ""msg": "Failed to authenticate: Authentication failed: transport shut down or saw EOF""

2024-01-05 Thread Alex D.
Hi. I have the same problem with Ansible 2.16.2 installed via PIP in venv. Using the same config/inventory/playbook I have no problems when using Ansible 2.9.6 installed on Ubuntu 20.04 with Python 3.8 This is my cfg file: [defaults] inventory = ./inventory host_key_checking = False

Re: [ansible-project] Re: how to encrypt ssh_pass password without asking any more password

2023-12-15 Thread Brian Coca
SSH_ASKPASS also requires DISPLAY (X11 working) so it is not really viable option for Ansible as it is often run from a configuration server/instance that rarely has X11 installed. But if you have such an environment you should be able to set it up that way. -- Brian Coca -- You

Re: [ansible-project] Re: how to encrypt ssh_pass password without asking any more password

2023-12-15 Thread dbs34
ed to only be ready > by your user. > > > > *From:* ansible...@googlegroups.com *On > Behalf Of *Todd Lewis > *Sent:* Thursday, December 14, 2023 11:32 PM > *To:* Ansible Project > *Subject:* [ansible-project] Re: how to encrypt ssh_pass password without > asking any more pas

RE: [ansible-project] Re: how to encrypt ssh_pass password without asking any more password

2023-12-15 Thread Stuart Lowe
and have it reference somewhere on your machine that isn’t included in your source control and protected to only be ready by your user. From: ansible-project@googlegroups.com On Behalf Of Todd Lewis Sent: Thursday, December 14, 2023 11:32 PM To: Ansible Project Subject: [ansible-project] Re: how

[ansible-project] Re: how to encrypt ssh_pass password without asking any more password

2023-12-14 Thread Todd Lewis
According to the conversation at https://forum.ansible.com/t/ansible-inventory-as-json-and-inline-vaulted-data-does-not-work-works-with-yaml-inventory/2909 true .yaml inventories permit vaulted values, so that should work for your requirements. You'll need to convert your inventory from .ini

[ansible-project] Re: how to encrypt ssh_pass password without asking any more password

2023-12-14 Thread Todd Lewis
I apologize for this type of response, because they bug me a lot. It's when someone says, "I want to do X. How do I do X?" And the responder say, "You should want Y!" I don't see an option in Ansible to read the ssh_pass from a file. However, native ssh itself can be made to run the script

[ansible-project] Re: Copy to report

2023-12-08 Thread Todd Lewis
The first one lists all the rpms installed on the system. The second one list only the available updates. Perhaps there are none? You'll have to convince me that debug output ends up in either /tmp/updates.txt or /tmp/installed.txt. I'm highly skeptical of that claim. On Friday, December 8,

[ansible-project] Re: Statement not executed or executed statement has no resultset

2023-12-01 Thread Narmada Karthika
correcting the yml formatting - name: Insert into sql server community.general.mssql_script: login_user: 'username' login_password: "{{ mssql_login_password }}" login_host: "{{ mssql_server }}" login_port: "{{ mssql_port }}" db: testdb script: "insert into

[ansible-project] Re: Release announcement: Ansible Community Package 9.0.0rc1 (Pre-Release)

2023-11-14 Thread Anwesha Das
Hello everyone, There is a typo in my previous email, this is a RC1 (Release Candidate 1) release and not Alpha release. Sorry for the typo and the confusion. Cheers Anwesha On Tue, Nov 14, 2023 at 5:41 PM Anwesha Das wrote: > > Hello everyone, > > We're happy to announce the Alpha release of

Re: [ansible-project] Re: how to append to a line keeping

2023-11-08 Thread Sameer Modak
Thanks a lot Todd for making us learn new thing and developing more interest in ansible. Absolute thanks Todd. On Wednesday, November 1, 2023 at 7:12:16 PM UTC+5:30 Todd Lewis wrote: > The short answer is no. If you want to modify the string with backrefs, > then lineinfile will not create

[ansible-project] Re: get item from nested loop item

2023-11-01 Thread Todd Lewis
It's hard to tell from this platform's poor support of indentation, but it appears "hostenv" is a list. Try loop: "{{ hostenv[0].Serverconf.Interface }}" On Wednesday, November 1, 2023 at 9:35:35 AM UTC-4 Vaishnave M wrote: > Hi, > > I have list of items in configuration files as variable >

Re: [ansible-project] Re: how to append to a line keeping

2023-11-01 Thread Todd Lewis
The short answer is no. If you want to modify the string with backrefs, then lineinfile will not create the line if it doesn't exist. But step back and consider your options for managing your override.conf file. A. The best scenario is to take total ownership of the entire file, generating

[ansible-project] Re: how to append to a line keeping

2023-11-01 Thread Sameer Modak
Hello Team, I could figure out after 10 tries this is how i got it - name: append the line lineinfile: path: /tmp/hello.txt backrefs: yes regexp: '^(.*KAFKA_JMX_OPTS.*)$"'. < line: '\1

Re: [ansible-project] Re: how to set different backup directory than current while using backup=yes

2023-10-31 Thread Todd Lewis
That looks fine as far as it goes. I think we all agree that none of this is particularly hard to implement. However, the way I read the original poster's original problem, there is an implied constraint: One cannot go creating additional files in the .conf directory. Full stop. So the

Re: [ansible-project] Re: how to set different backup directory than current while using backup=yes

2023-10-31 Thread Vladimir Botka
On Tue, 31 Oct 2023 05:17:35 -0700 (PDT) Todd Lewis wrote: > There is no backup system. ... I wouldn't have been able > to create such a thing ... I wouldn't dare use it in > production ... the rest of us have to build our > wheels with the stick-n-stones within our reach. > > On Monday,

Re: [ansible-project] Re: how to set different backup directory than current while using backup=yes

2023-10-31 Thread Sameer Modak
Thanks todd for explanation On Tuesday, October 31, 2023 at 5:47:35 PM UTC+5:30 Todd Lewis wrote: > (For background, a great discussion surrounding the missing backup_dir: > task option can be read here: here > . Highly recommended.) > > You

Re: [ansible-project] Re: how to set different backup directory than current while using backup=yes

2023-10-31 Thread Todd Lewis
(For background, a great discussion surrounding the missing backup_dir: task option can be read here: here . Highly recommended.) You are absolutely correct, and yet I must respectfully disagree with practically every point. > The backup system

Re: [ansible-project] Re: how to set different backup directory than current while using backup=yes

2023-10-30 Thread Brian Coca
This is an example role I made https://github.com/bcoca/local_backup. this is just ONE way to do it. If using awx/Tower/Controller I would recommend creating a workflow. -- -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project"

Re: [ansible-project] Re: how to set different backup directory than current while using backup=yes

2023-10-30 Thread solarflow99
Is there any code example of this? On Mon, Oct 30, 2023 at 8:34 AM Brian Coca wrote: > The backup system returns the 'backup_file' information so you can > then operate on the built in backup, like moving it to a central > location on the target, copying it to a backup server and/or managing

Re: [ansible-project] Re: how to set different backup directory than current while using backup=yes

2023-10-30 Thread Brian Coca
The backup system returns the 'backup_file' information so you can then operate on the built in backup, like moving it to a central location on the target, copying it to a backup server and/or managing the number/recency of backups. I would not 'manage it beforehand' as you do not know if a

[ansible-project] Re: how to set different backup directory than current while using backup=yes

2023-10-30 Thread Todd Lewis
That's not an option. Your best bet is to handle the backup yourself before invoking ansible.builtin.copy or ansible.builtin.template etc. and don't specify backup (or "backup: false"). Use ansible.builtin.stat to get the mtime. Then use ansible.builtin.copy to copy the .conf file where you

Re: [ansible-project] Re: how to extract minor version from major version variable

2023-10-25 Thread Todd Lewis
If you can manage to express your problem in terms of a test, then you can use Ansible's version test: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/version_test.html Otherwise, Ansible's own utils/version.py (which is used by the version test) uses the following regex.

[ansible-project] Re: how to extract minor version from major version variable

2023-10-25 Thread Sameer Modak
i tried with regex_replace('^([0-9])\\.([0-9]*).*', '\\1.\\2') but is there any other better way to do it On Wednesday, October 25, 2023 at 6:16:34 PM UTC+5:30 Sameer Modak wrote: > Hello Team, > > What is the correct way to extract just major version from full version > like , > > full

[ansible-project] Re: Error handling in ios_config module

2023-10-18 Thread Peter Rubenstein
This seems to still be broken all these years later. I'm hitting the exact same issue with "crypto map". Is there a workaround? ansible --version ansible [core 2.15.4] config file = /home/plrub160/git/isp_link_change/ansible.cfg configured module search path =

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-20 Thread Ashok Reddy
Hi Todd, I will provide that information. On Wed, 20 Sep 2023 at 10:20 PM, Todd Lewis wrote: > > > On 9/20/23 5:24 AM, Ashok Reddy wrote: > > I tried without using serial=1 but can’t make it to work > > On Wed, 20 Sep 2023 at 5:06 PM, Ashok Reddy wrote: > >> Hi David, >> >> I tried using

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-20 Thread Todd Lewis
On 9/20/23 5:24 AM, Ashok Reddy wrote: I tried without using serial=1 but can’t make it to work On Wed, 20 Sep 2023 at 5:06 PM, Ashok Reddy wrote: Hi David, I tried using block level but it throws error Neither of these responses is informative. What results - from the job log -

[ansible-project] Re: The input device is not a TTY

2023-09-18 Thread 'jojebo' via Ansible Project
If I delete these two lines async: 1200 poll: 10 it works! But I would like to start the task on all of the servers at once which needs async, right? jojebo schrieb am Mittwoch, 13. September 2023 um 14:10:37 UTC+2: > I removed the ssh arguments → “the input device is not a TTY”

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-18 Thread Ashok Reddy
I will send On Mon, 18 Sep 2023 at 4:02 PM, Dick Visser wrote: > > > On Mon, 18 Sept 2023 at 09:03, Ashok Reddy wrote: > >> Hi John, >> >> I have configured the meta_play: end_play in roles where the task has >> failed but it will not exit . >> Can you please guide me? >> > > Please focus on

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-18 Thread Dick Visser
On Mon, 18 Sept 2023 at 09:03, Ashok Reddy wrote: > Hi John, > > I have configured the meta_play: end_play in roles where the task has > failed but it will not exit . > Can you please guide me? > Please focus on the actual problem, and respond to Todd's mail and provide the requested data. --

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-17 Thread Ashok Reddy
Hi Todd, Thanks for your help. I will send you On Thu, 14 Sep 2023 at 11:42 AM, Todd Lewis wrote: > That's a task file, not a playbook. But at least you've quit posting > pictures of your screen. The problem does not appear to be in that file. > > Of the 5 things I asked for, you've now done

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-13 Thread Todd Lewis
That's a task file, not a playbook. But at least you've quit posting pictures of your screen. The problem does not appear to be in that file. Of the 5 things I asked for, you've now done the third one. 1. the command line you use to invoke this playbook 2. the playbook itself 3. the

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-13 Thread Ashok Reddy
Hi All, PFA for the ansible playbook On Wed, 13 Sep 2023 at 10:14 PM, Dick Visser wrote: > > > On Wed, 13 Sept 2023 at 09:43, Ashok Reddy wrote: > >> Hi Brian, >> >> Did not configure the ignore_errors in playbook >> > > You didn't show any playbook so far, just (fuzzy pictures of computer >

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-13 Thread Dick Visser
On Wed, 13 Sept 2023 at 09:43, Ashok Reddy wrote: > Hi Brian, > > Did not configure the ignore_errors in playbook > You didn't show any playbook so far, just (fuzzy pictures of computer screens with) task files that are included. If you can post the TEXTUAL version of the playbook that includes

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-13 Thread Brian Coca
Not in the part you are showing, but the output you showed has `ignoring ..` which you only get with that keyword. -- -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving

[ansible-project] Re: The input device is not a TTY

2023-09-13 Thread 'jojebo' via Ansible Project
I removed the ssh arguments → “the input device is not a TTY” I set usetty to true → “the input device is not a TTY” ssh -t test2@* dest ip ** “source toolrc && tool” → works So it is basically possible to run the script via ssh with the -t argument. jojebo schrieb am Donnerstag, 7. September

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-13 Thread Ashok Reddy
Hi Brian, Did not configure the ignore_errors in playbook On Tue, 12 Sep 2023 at 10:13 PM, Brian Coca wrote: > from the output you have EXPLICIT ignores to the failures, that is why > Ansible is continuing to more tasks, remove the ignores if you don't want > the failure to be ignored. > > --

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-12 Thread Brian Coca
from the output you have EXPLICIT ignores to the failures, that is why Ansible is continuing to more tasks, remove the ignores if you don't want the failure to be ignored. -- -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project"

Re: [ansible-project] Re: Regarding not to proceed further if ansible task fails

2023-09-11 Thread Todd Lewis
I don't wish to defend the horrid things that Google Groups does to pasted text, particularly where whitespace matters. However, photos of text is about useless. For example, there's no practical way to run a linter on pictures of text. It's impossible to say with certainty that a task in a

Re: [ansible-project] Re: Issue copying files in playbook to RHEL 7 servers

2023-09-09 Thread Nico Kadel-Garcia
On Fri, Sep 8, 2023 at 10:17 AM lift...@gmail.com wrote: > > OK, what I ended up doing was adding "ansible_python_interpreter=/bin/python" > on all RHEL 7 hosts in /etc/ansible/hosts, and the file copy worked. > > Thanks, > Harry > Use "/usr/bin/python3" for clarity. The "platform python"

[ansible-project] Re: Issue copying files in playbook to RHEL 7 servers

2023-09-09 Thread Todd Lewis
> I don't think that we can update Python on RHEL 7. We are running python3-3.6.8-19.el7_9.x86_64 on our few remaining RHEL 7 hosts. On Friday, September 8, 2023 at 9:15:51 AM UTC-4 lift...@gmail.com wrote: > We have the playbook below to copy an updated script to our servers. The > copy

Re: [ansible-project] Re: Issue copying files in playbook to RHEL 7 servers

2023-09-09 Thread David Logan
Hi Harry, Have a read here https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html maybe set to auto_legacy. I have a mixed fleet and had issues with the copy command, I ended up using jinja templates to push the scripts out to the appropriate place across all

[ansible-project] Re: Issue copying files in playbook to RHEL 7 servers

2023-09-08 Thread lift...@gmail.com
OK, what I ended up doing was adding "ansible_python_interpreter=/bin/python" on all RHEL 7 hosts in /etc/ansible/hosts, and the file copy worked. Thanks, Harry On Friday, September 8, 2023 at 9:45:28 AM UTC-4 lift...@gmail.com wrote: > Well, the controller I'm running the playbook from is

[ansible-project] Re: Issue copying files in playbook to RHEL 7 servers

2023-09-08 Thread lift...@gmail.com
Well, the controller I'm running the playbook from is RHEL 8 and has the following version: ansible [core 2.14.6] config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location

[ansible-project] Re: Issue copying files in playbook to RHEL 7 servers

2023-09-08 Thread Todd Lewis
Maybe throw a few "-v"s on the command line and give us the job log? Whether Python 2.7.5 is an issue will also depend on what version of Ansible you are using, and we don't know that either. With the limited info you've given, the only solution is to upgrade all your RHEL 7 servers to at

  1   2   3   4   5   6   7   8   9   10   >