[ansible-project] Abort playbook if host is not ready

2020-05-28 Thread Laci
Is there a good way to abort the playbook if host is not ready? For example I want to run a playbook against *thisserver*, but *thisserver* is unreachable by ssh or it is reachable but there is no python install. If any of these occurs I'd like to playbook to abort and stop processing tasks --

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

2020-06-12 Thread Laci
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 known hosts.\r\nPermission denied (publickey,gssa

Re: [ansible-project] Abort playbook if host is not ready

2020-06-15 Thread Laci
Thank you! -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://gro

[ansible-project] how to determine group's id?

2020-07-14 Thread Laci
Do you guys have a good idea what is the best way to determine a group's id them reuse that in a variable? For ex: % getent group monitor monitor:x:990:polkitd I need 990, then I have to add a line to /etc/fstab including 990 Thanks! -- You received this message because you are subscribed to t

Re: [ansible-project] how to determine group's id?

2020-07-15 Thread Laci
Thank you guys, this fixes the first part. But how do I reuse the output of getent, I tried, the following but didn't work - getent: database: group - debug: var: getent_group.monitor - name: add line to fstab lineinfile: path: /etc/fstab line: proc/procp

[ansible-project] Re: how to determine group's id?

2020-07-15 Thread Laci
Thank you, this did it: - name: set fact for group set_fact: group_id: "{{ getent_group.monitor[1] }}" - name: Add proc to fstab and mount it mount: path: /proc src: proc fstype: proc opts: "defaults,hidepid=2,gid={{ group_id }}" dump: 0

[ansible-project] scan servers if package is installed and send email

2020-08-13 Thread Laci
I'm looking for a playbook which would scan all servers and if a particular package (ex: kernel-3.10.0-1062 or nginx-1.12.2-2) is installed would send an email with the hostname. Did anyone do something alike? -- You received this message because you are subscribed to the Google Groups "Ansibl

Re: [ansible-project] scan servers if package is installed and send email

2020-08-13 Thread Laci
20:51 -0700 (PDT) > Laci > wrote: > > > I'm looking for a playbook which would scan all servers and if a > particular > > package (ex: kernel-3.10.0-1062 or nginx-1.12.2-2) is installed would > send > > an email with the hostname. > > Did anyone do s

Re: [ansible-project] scan servers if package is installed and send email

2020-08-13 Thread Laci
Awesome, thank you very much! On Thursday, August 13, 2020 at 1:47:07 PM UTC-4, Vladimir Botka wrote: > > Laci, > > On Thu, 13 Aug 2020 08:47:31 -0700 (PDT) > Laci > wrote: > > > ... it finds the package only if no specific version is > > specified. For ex

[ansible-project] Remove a line from file and surrounding

2022-06-14 Thread Laci
I'm working on a playbook which would remove lines from a file containing specific hostname. I want to use Ansible to remove the hostname AND surrounding lines. Here is an example of a block that I need to remove: FileSet { Name = "vcenter-hostname05" Include { Options { signature = SHA1

[ansible-project] Re: Remove a line from file and surrounding

2022-06-14 Thread Laci
So far my best option is to run a command which invokes sed On Tuesday, June 14, 2022 at 2:30:01 PM UTC+2 Laci wrote: > I'm working on a playbook which would remove lines from a file containing > specific hostname. > I want to use Ansible to remove the hostname AND surrounding lin

[ansible-project] Re: Remove a line from file and surrounding

2022-06-21 Thread Laci
ible > Documentation > <https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html> > or use the *shell module* to work with sed! > > On Tuesday, June 14, 2022 at 4:59:38 PM UTC+2 Laci wrote: > >> >> So far my best option is to run a c

[ansible-project] escaping curly braces in lineinfile module

2020-05-12 Thread Laci
I am new in Ansible world. I spent some time solving this but got to the point when I need to ask: I have a file called jobs.inc and I need to add six lines with Ansible. Here is an example % cat jobs.inc Job { Name= "server1" Client = "server1-fd" JobDefs = "DefaultJob" } Job { Name

Re: [ansible-project] escaping curly braces in lineinfile module

2020-05-12 Thread Laci
} backup: yes On Tuesday, May 12, 2020 at 3:47:30 PM UTC-4, Vladimir Botka wrote: > > On Tue, 12 May 2020 12:32:11 -0700 (PDT) > Laci > wrote: > > > % cat jobs.inc > > Job { > > Name= "server1" > > Client = "server

Re: [ansible-project] escaping curly braces in lineinfile module

2020-05-14 Thread Laci
Actually this is my goal. We are going to have add new servers every time to this file. So the following lines will be repeated X times Job { Name= "serverX" Client = "serverX-fd" JobDefs = "DefaultJob" } > > "Using a custom marker without the {mark} variable m

Re: [ansible-project] escaping curly braces in lineinfile module

2020-05-14 Thread Laci
JobDefs = "DefaultJob" } Linux: Job { Name= "serverX" Client = "serverX-fd" JobDefs = "DefaultJob" FileSet = "linux" } On Thursday, May 14, 2020 at 10:31:36 AM UTC-4, Laci wrote: > > Actually this is my

[ansible-project] copy restricted files from server A to B

2020-05-19 Thread Laci
I have some files with 0400/-r permissions on server A that I need to copy to server B and preserve permissions. For example: serverA:/etc/ssl_cert.key -> serverB:/etc/ssl_cert.key How would you do it? -- You received this message because you are subscribed to the Google Groups "Ansib

[ansible-project] Re: copy restricted files from server A to B

2020-05-19 Thread Laci
Another detail is that serverA can't talk to serverB or vice versa, only the Ansible server can talk to both of them On Tuesday, May 19, 2020 at 2:29:49 PM UTC-4, Laci wrote: > > I have some files with 0400/-r permissions on server A that I need > to copy to server

Re: [ansible-project] Re: copy restricted files from server A to B

2020-05-20 Thread Laci
ch (to get the file on the > controller), and stat (to get rights) modules > > Regards, > > JYL > > > Le 19/05/2020 à 22:38, Laci a écrit : > > Another detail is that serverA can't talk to serverB or vice versa, only > the Ansible server can talk to both of